-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Feature
Add an integrated diff viewer mode to the terminal application that allows users to inspect code changes made during the current or previous LLM sessions, and interact with the model at a line or block level. This would reduce the need to scroll through long chat histories or manually run external git diff commands to understand and refine changes.
Motivation
Current workflow issues:
- When the agent edits multiple files, I have to:
- Scroll back through the chat history to reconstruct what changed, or
- Approve all changes blindly and then use
git diffto see what actually happened.
- Sometimes I commit changes between iterations, so diffs span:
- “Last assistant edit” vs working tree
- Or “since last commit” vs working tree
- Reviewing changes file-by-file via prompts is slow and noisy:
- Approving each file individually is tedious.
- Approving everything at once is risky if I can’t easily audit the combined diff.
- I often want to refine specific lines or small code blocks:
- Right now I have to copy/paste the relevant snippet into the chat and frame a new prompt.
- This is error-prone and breaks flow.
A built-in diff viewer with chat integration would make the iteration loop much more controlled, auditable, and efficient.
1. Diff Viewer Mode
- Trigger: A dedicated command, e.g. in the
Ctrl+Pmenu (or similar), and add “Diff Viewer” mode/option.
Presentation - Open a new window or side panel in the TUI (depending on how the project prefers handling split views).
- Show diffs in a standard unified or side-by-side format, with:
3. Approval Mode? (Optional side idea)
Maybe implement a more iterative approval mode? Each file needs approval to write and review? I know the Plan functionality is kind of like this but this would be more pure code block by code block.
2. Line / Block-Level Chat Integration
Inside the diff viewer:
- Ability to select a specific line or range of lines:
- Via keyboard (e.g., moving cursor to a line and marking a range).
- Once selected, user can:
- Press a key (e.g.,
c) to “Chat about this selection”. - The selection is sent as rich context to the agent, and a new prompt is opened pre-populated with:
- The selected snippet
- Optional metadata (file path, line numbers, current diff context).
- Press a key (e.g.,
- Typical use cases:
- “Explain why you changed this logic.”
- “Refactor this block for clarity/performance.”
- “Can we roll back only this part of the change?”
- “Generate tests for this specific function.”
The goal is to avoid manual copy/paste and keep discussions anchored to concrete code regions.
I was thinking on implementing this feature myself, but wanted to follow the guide and see what the design team thinks?