No diff shown when accepting changes from Claude Code #2114
Replies: 11 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
|
There is nothing in :messages When using Anthropic http adapter with tools, diff is shown as expected. Sample buffer: Prompt: |
Beta Was this translation helpful? Give feedback.
-
|
I don't believe this is a CodeCompanion issue. We implement the agent client protocol so it's up to Claude Code to output the diff as per the spec at https://agentclientprotocol.com/protocol/tool-calls#diffs Feel free to share the RPC output from the logs to show me otherwise. |
Beta Was this translation helpful? Give feedback.
-
|
I have gone through the log and it does indeed seem to contain message with content "type": "diff". Line 67 of the attached log. It seems to be in the correct format. Maybe it is a message sequence issue? |
Beta Was this translation helpful? Give feedback.
-
|
For the clarity of anyone else reading this issue, referencing your logfile, you're seeing two updates.
{
"jsonrpc": "2.0",
"method": "session/update",
"params": {
"sessionId": "01992e15-e1e7-7262-af71-23f93ea6452f",
"update": {
"toolCallId": "toolu_01EyeLpzh5t2h6qnfGkyMbTo",
"sessionUpdate": "tool_call",
"rawInput": {
"abs_path": "/Users/bstastny/projects/test1/hello.txt",
"old_string": "This file has been updated with new content.",
"new_string": "This file has been updated with new content.\nThanks for using our project!"
},
"status": "pending",
"title": "Edit `/Users/bstastny/projects/test1/hello.txt`",
"kind": "edit",
"content": [
{
"type": "diff",
"path": "/Users/bstastny/projects/test1/hello.txt",
"oldText": "This file has been updated with new content.",
"newText": "This file has been updated with new content.\nThanks for using our project!"
}
],
"locations": [
{
"path": "/Users/bstastny/projects/test1/hello.txt"
}
]
}
}
}
{
"jsonrpc": "2.0",
"id": 0,
"method": "session/request_permission",
"params": {
"options": [
{
"kind": "allow_always",
"name": "Always Allow",
"optionId": "allow_always"
},
{
"kind": "allow_once",
"name": "Allow",
"optionId": "allow"
},
{
"kind": "reject_once",
"name": "Reject",
"optionId": "reject"
}
],
"sessionId": "01992e15-e1e7-7262-af71-23f93ea6452f",
"toolCall": {
"toolCallId": "toolu_01EyeLpzh5t2h6qnfGkyMbTo",
"rawInput": {
"abs_path": "/Users/bstastny/projects/test1/hello.txt",
"old_string": "This file has been updated with new content.",
"new_string": "This file has been updated with new content.\nThanks for using our project!"
}
}
}
}Thus far, I've built the diff around the following payload (which Gemini CLI follows): {
"jsonrpc": "2.0",
"id": 0,
"method": "session/request_permission",
"params": {
"sessionId": "370030f3-a287-4054-b2a7-010b4bb084e8",
"options": [
{
"optionId": "proceed_always",
"name": "Allow All Edits",
"kind": "allow_always"
},
{
"optionId": "proceed_once",
"name": "Allow",
"kind": "allow_once"
},
{
"optionId": "cancel",
"name": "Reject",
"kind": "reject_once"
}
],
"toolCall": {
"toolCallId": "write_file-1754861800410",
"status": "pending",
"title": "Writing to test.txt",
"content": [
{
"type": "diff",
"path": "test.txt",
"oldText": "This is some old text",
"newText": "This is some new text"
}
],
"locations": [],
"kind": "edit"
}
}
}So in summary, Claude prefers to make an edit and then ask the user to approve / reject it rather than just show the edit to the user. This is a potentially tricky workflow to have to account for. I'll have a think if and how we could account for this. Might be worth raising this upstream too |
Beta Was this translation helpful? Give feedback.
-
|
I see the issue, thank you. Feel free to change this bug report to a discussion, however, I must say that the current handling of Claude ACP messages makes it very hard to use as a coding agent. The main issue is that the user doesn't see the changes they are asked to accept. I have looked at the current integration of Claude in the Zed and Intellij editors. The common action both editors take is to display the diff directly in the chat window. This is probably as a result of processing the "session/update", which contains the diff. Following that, the user is asked for permission and see the changes again as a diff in the edited file. Looking through the CodeCompanion repo, I see a couple of admittedly not so great options of handling the Claude message sequence.
Option 1 doesn't actually show the diff in the edited buffer, Option 2 does not seem as per the ACP specification (although it might be what the Intellij plugin actutally does), Option 3 has obvious downsides of a stateful processing. |
Beta Was this translation helpful? Give feedback.
-
|
I'll flag this with the Zed team tomorrow. It might be they're facing restrictions in how they've implemented the adapter and they may require native support with Claude Code. |
Beta Was this translation helpful? Give feedback.
-
|
Man, I was so hyped to finally use CodeCompanion again, but this just killed it for me again. Awesome stuff you are doing, but without a diff the ACP functionality is pretty useless imo. |
Beta Was this translation helpful? Give feedback.
-
|
Regardless of what the Zed team come back with, we'll get this working in the plugin in the coming weeks. |
Beta Was this translation helpful? Give feedback.
-
|
Hi All This has been patched in I'll also be merging another patch tomorrow for a better diff UI. |
Beta Was this translation helpful? Give feedback.
-
|
I've been seeing this exact behavior with OpenCode as well 😞 |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission checklist
Neovim version (nvim -v)
NVIM v0.11.4
Operating system/version
macOS 15.5 (24F74)
Adapter and model
Claude Code ACP
Describe the bug
When asking Claude Code to make changes to #{buffer}, no diff with changes is shown. Changes are written correctly to the buffer, however, I would expect a diff to be shown first.
Steps to reproduce
Expected behavior
Diff view is shown when agent asks for a permission to write as depicted here: #2030
Screenshots or recordings (optional)
Screen.Recording.2025-09-09.at.9.49.08.mov
minimal.lua file
Log output (optional)
No response
Minimal reproduction confirmation
minimal.luafile that reproduces the issueBeta Was this translation helpful? Give feedback.
All reactions