feat IDE Integration: Live text selection and diff review/approval. #5447
Open
tcdent wants to merge 5 commits intoanomalyco:devfrom
Open
feat IDE Integration: Live text selection and diff review/approval. #5447tcdent wants to merge 5 commits intoanomalyco:devfrom
tcdent wants to merge 5 commits intoanomalyco:devfrom
Conversation
… into prompt context, diff display view
Suggested UX improvements for IDE selection displayHey @tcdent, great work on this PR! I've been testing it and made a few UX improvements that make the selection behavior closer to Claude Code: Changes:1. Compact footer display (
2. Persistent selection (
3. Invisible context for model (
Code changes:local.tsx - simplified formatted()formatted: () => {
const sel = selStore.current
if (!sel || !sel.text) return null
const lines = sel.text.split("\n").length
return \
},prompt/index.tsx - synthetic part for selectionparts: [
{
id: Identifier.ascending("part"),
type: "text",
text: inputText,
},
...(local.selection.current()?.text ? [{
id: Identifier.ascending("part"),
type: "text" as const,
text: \,
synthetic: true,
}] : []),
...nonTextParts.map((x) => ({
id: Identifier.ascending("part"),
...x,
})),
],prompt/index.tsx - remove selection.clear() after submit- local.selection.clear()Let me know if you'd like me to open a separate PR with these changes! |
|
Update: Also added IDE/selection display to \ footer, so it's visible from launch (not just inside sessions). |
tofunori
pushed a commit
to tofunori/opencode
that referenced
this pull request
Dec 21, 2025
- Add IDE connection via WebSocket with JSON-RPC - Live text selection from editor displayed in footer - Selection sent as synthetic part (invisible but included in context) - IDE status visible in home screen footer - Fix reactivity with reconcile for IDE status updates Based on initial work from anomalyco#5447, with additional UX improvements.
Author
|
@tofunori Stoked you're finding use for it. By all means continue to improve on this PR; I'm not emotionally attached to any of the implementation details. |
|
Cheers! Hope it could get merged ! |
shuv1337
added a commit
to Latitudes-Dev/shuvcode
that referenced
this pull request
Dec 21, 2025
Adds IDE integration with server APIs from anomalyco#5447: - WebSocket-based IDE connections - IDE server endpoints and SDK types - Streamed cursor selection into prompt context - Diff display view for file edits This provides the backend foundation for IDE integration.
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Forgive me for being a Claude Code user up until this point; excited about being able to contribute to an open workflow instead of opening tickets and watching them go stale. One aspect of my workflow I really enjoy is the ability to send my highlights directly into context, and also have diffs appear in my IDE.
This patch uses the existing
coder/claudecode.nvim(and probably the existing VSCode extension I haven't tested yet) to connectopencodeto the websocket server they provide.After installing the plugin, launch
opencodeand use the/idecommand to select from the available open sockets. In nvim visual mode your selection will be automatically updated in the prompt window. When the agent proposes a change the diff will appear in the IDE and can either be approved inside the IDE or in the terminal session.In order to not hard-code any third party references, I made a couple config updates to
opencode.jsonthat are necessary for this to work:{ "ide": { "lockfile_dir": "/Users/tcdent/.claude/ide/", "auth_header_name": "x-claude-code-ide-authorization" } }Also, in order to get diff approval to wait for input, setting permission is necessary:
{ "permission": { "edit": "ask" } }This is more of a PoC than a production-ready feature and I'm sure everyone on the team here has some opinion about this, so I'm happy to continue working on this. For one thing, we should coordinate with an existing plugin maintainer for an opencode-specific integration. For now, this has made
opencodea drop-in replacement for my existing workflow, and I'm excited to own my entire dev environment again.