Skip to content

feat(vscode): push active editor selection to TUI via lock file#27662

Open
Restodecoca wants to merge 6 commits into
anomalyco:devfrom
Restodecoca:feat/vscode-editor-context
Open

feat(vscode): push active editor selection to TUI via lock file#27662
Restodecoca wants to merge 6 commits into
anomalyco:devfrom
Restodecoca:feat/vscode-editor-context

Conversation

@Restodecoca
Copy link
Copy Markdown

@Restodecoca Restodecoca commented May 15, 2026

Issue for this PR

Closes #22235

Related: #3095, #3096

Type of change

  • New feature

What does this PR do?

The VS Code extension now starts a WebSocket server that pushes the active
editor file and text selection to opencode in real time, using the existing
Claude Code IDE lock file protocol. Previously, the extension only sent the
file path when the user manually invoked the "Add Filepath to Terminal"
command.

  • Starts a WebSocket server on a random port when the extension activates
  • Writes a lock file to ~/.claude/ide/.lock so the opencode TUI
    discovers and connects automatically
  • Pushes selection_changed JSON-RPC notifications on active editor or
    text selection change
  • Cleans up the lock file and closes the server on deactivation

How did you verify your code works?

  • bun run check-types passes
  • bun run lint passes
  • Built and packaged with npx vsce package
  • Installed VSIX locally, confirmed lock file created in ~/.claude/ide/
  • Connected via WebSocket client, confirmed selection_changed events when
    selecting text

Screenshots / recordings

image
opencode.-.arquitetura-etapa-1.3-modelagem-inicial-api-poc-86agd9a2m.-.Visual.Studio.Code.2026-05-15.00-58-02.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found a potential related PR:

PR #18649: "feat: live IDE context awareness"
#18649

This PR appears related as it addresses IDE context awareness, which aligns with the goal of pushing active editor selection to the TUI. It may be addressing similar or overlapping functionality for automatically including currently open file and selected lines as context.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Restodecoca Restodecoca mentioned this pull request May 15, 2026
@Restodecoca
Copy link
Copy Markdown
Author

Also relates to #27420 — opencode's own VS Code extension not showing file/selection context while the Claude Code extension does.

@Restodecoca
Copy link
Copy Markdown
Author

Also related to #3472 and #7275 — these are earlier reports of the same VS Code context awareness gap (files/selection not flowing to the TUI automatically).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDE (VSCode): Context Awareness function didn’t take effect.

1 participant