Native Claude Code IDE integration (terminal CLI ↔ editor), like VS Code/JetBrains #58338
Replies: 5 comments 2 replies
|
I would add that this is of great importance given the recent changes to Claude's billing which would charge ACP users at API rates. This would allow continued usage of Zed with the included Claude usage |
|
I'm not familiar enough with Zed internals to say whether this should be merged as-is, but this should be taken as a great illustrative example of something that should be doable with an extension in the future (but isn't right now). For practicality's sake I'm in favor of merging this or something similar. Inline diff reviews in particular are very nice to have compared to the TUI. |
|
On neovim https://github.com/coder/claudecode.nvim this is amazing. Still allows claude code in a terminal but files and diffs are in neovim. With Terminal Threads i keep running into local edits clobbering each other, etc. |
|
A few people asked about the security/footprint of the implementation in PR #58300, so to address it up front: Current behavior: the server binds at workspace startup for every open window, whether or not you launch Claude Code. The exposure is intentionally contained and mirrors what the official VS Code / JetBrains / Neovim integrations do:
Honest caveats:
Proposed improvement: add an explicit setting to control this, e.g. an enable/disable toggle and/or lazy binding (only start the server the first time Claude Code is actually used in a terminal, instead of at every workspace startup). Happy to implement whichever direction the team prefers — wanted to get the security model and the opt-out idea on the record before review. |
|
I tried your fork and ran into a couple bugs (and a couple api changes), so pushed my own fork: fork: https://github.com/uberjay/zed/ Unsure if this is due to protocol/behavior changes, or something specific to my environment. It works well after the fixes! Change: da3f460 edit: unfortunately, it seems as though a lot of things don't work smoothly with my dev build of Zed, otherwise I would just use it. (e.g., I couldn't get other extensions, acp, agents, etc to work in my dev build.) The claude code IDE integration worked well, but there were too many other things that didn't, and I don't have time to figure it out!. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Zed already supports Claude Code as an ACP agent in the agent panel. It does
not implement Claude Code's "IDE integration" protocol — the one the
claudeCLI uses to attach to VS Code, JetBrains and Neovim. As a result,running
claudein Zed's integrated terminal cannot see your selection, openeditors, or diagnostics, and cannot show accept/reject diffs inside the editor.
Proposal
Implement the native IDE integration so
claudein Zed's terminal connects toZed like it does to other editors:
~/.claude/ide/<port>.lock(0600in a0700dir).x-claude-code-ide-authorization,speaking JSON-RPC 2.0 / MCP (protocol
2024-11-05).CLAUDE_CODE_SSE_PORT+ENABLE_IDE_INTEGRATIONinto the integrated terminal.
getCurrentSelection,getWorkspaceFolders,getOpenEditors,getDiagnostics,openFile,saveDocument,checkDocumentDirty, and ablocking
openDiff(side-by-side, Keep/Reject).Working implementation (fork)
I have a working implementation you can build and use today, until/if it lands
upstream:
claude-code-ide-integrationOpen the integrated terminal, run
claude— it auto-connects; editing a fileopens a Keep/Reject diff in the editor.
I'm happy to open a PR (linked below). Feedback on the approach and on UI
placement (currently a Keep/Reject notification) is welcome.
All reactions