-
Notifications
You must be signed in to change notification settings - Fork 778
feat: Add diff preview for ACP providers #2816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| local Utils = require("avante.utils") | ||
|
|
||
| ---@class avante.HistoryMessage | ||
| ---@class avante.history.Message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Missing fields were causing lua_ls to type them as
unknown - Rename as it was conflicting with the sidebar HistoryMessage
| diff_display:scroll_to_first_diff() | ||
| diff_display:register_cursor_move_events() | ||
| diff_display:register_navigation_keybindings() | ||
| diff_display:register_accept_reject_keybindings(on_accept_diff_block, on_reject_diff_block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid we would need to remove the hunk accept/reject until it's tied to the tool call confirmation.
There's a bug: if the user accepts all the hunks, the confirmation pop-up won't be dismissed.
Or if the user rejects 1 hunk, and then goes to the sidebar and "approve" it'll override and accept all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't quite understand this bug. What caused it?
|
Oops, some code conflicts |
|
solved! |
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
|
This PR was closed because it has been stalled for 10 days with no activity. |
|
Sorry, the bot closed it. I will merge this PR as soon as possible. |
|
@carlos-algms Excuse me. I test this PR on my service with claude-code + avante.nvim. I did not see the diff preview as expected. Can you help me to check my steps : My configurations : {
provider = "claude-code",
acp_providers = {
["claude-code"] = {
command = "npx",
args = { "@zed-industries/claude-code-acp" },
env = {
NODE_NO_WARNINGS = "1",
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY"),
},
},
},
}
claude will modify the file in the background but no diff view appears. Do I need to enable certain settings? |
|
@Waitzz have you checked this branch locally? You should not be required to do anything else. Maybe Claude changed the diff message since the last commit in this branch. |
|
It looks correct.
|
|
My Claude's version is : Waitzz@G3:~$ claude --version
2.0.43 (Claude Code)Could you tell me your Claude version? |
|
I just tried the changes from this PR as well, and I don't see any diff appearing on Gemini CLI; it just edits the file in the background. I'm on version 0.22.2 of Gemini CLI and am on the latest push to this branch. |
ACP Diff Preview Feature
Overview
Adds visual diff preview functionality for ACP (Agent Client Protocol) providers, allowing users to see proposed changes directly in their buffers before applying them.
Core Feature
acp_show_diff_in_buffersetting (defaults totrue)Architecture & Refactoring
diff_display.luautility module for reusable diff renderingacp_diff_handler.luamodule for ACP-specific diff extraction and processingacp_diff_preview.luamodule for buffer preview managementllm.luaConfiguration Changes
acp_follow_agent_locations?acp_show_diff_in_buffer(focuses on diff preview vs. auto-navigation)Type System Improvements
ToolCallUpdateRequestPermissionACPRawInputCode Quality
replace_in_file.luaUI Enhancements