feat(ide): IDE integration with Cursor/VSCode and improved UX
Summary
Complete IDE integration for OpenCode, enabling live text selection from Cursor/VSCode/Windsurf with improved UX.
Features
- IDE Connection: WebSocket-based connection to IDE extensions via lock files
- Live Selection: Real-time text selection from editor
- Footer Display: Shows IDE status and selection in footer (not cluttering input)
- Synthetic Context: Selection sent invisibly to model (doesn't pollute chat history)
- Home Screen: IDE/selection visible from launch, not just in sessions
Changes
Core IDE Integration
src/ide/index.ts- IDE connection management, status, eventssrc/ide/connection.ts- WebSocket client with JSON-RPC 2.0src/mcp/ws.ts- WebSocket transport for MCP
UX Improvements
local.tsx- Selection state withformatted()helper showing line counthome.tsx- IDE/selection display in home footerfooter.tsx- Selection display in session footerprompt/index.tsx- Synthetic parts for invisible context
Configuration
Add to opencode.json:
{
"ide": {
"lockfile_dir": "~/.claude/ide/",
"auth_header_name": "x-claude-code-ide-authorization"
}
}
Testing
- Install the OpenCode extension in Cursor/VSCode
- Launch OpenCode in terminal
- Connect to IDE via
/status - Select text in editor
- Verify footer shows:
[] 6 lines - Send message - selection content is included invisibly
Related
Based on initial work from #5447, with additional UX improvements:
- Selection displayed in footer instead of input area
- Synthetic parts so selection doesn't clutter chat history
- Home screen shows IDE connection status
@thdxr Would love your thoughts on IDE integration for OpenCode.
What this enables:
- Live text selection from Cursor/VSCode/Windsurf via WebSocket
- Selection displayed in footer (not cluttering the input)
- Synthetic context - selection sent to model without polluting chat history
Status:
- Based on @tcdent's work in #5447, with UX improvements
- Already tested and adopted by shuvcode fork
- Copilot review addressed
This brings OpenCode closer to Claude Code's IDE integration experience. Happy to make any changes needed for merge.
@thdxr Would love your thoughts on IDE integration for OpenCode.
What this enables:
- Live text selection from Cursor/VSCode/Windsurf via WebSocket
- Selection displayed in footer (not cluttering the input)
- Synthetic context - selection sent to model without polluting chat history
Status:
- Based on @tcdent's work in feat IDE Integration: Live text selection and diff review/approval. #5447, with UX improvements
- Already tested and adopted by shuvcode fork
- Copilot review addressed
This brings OpenCode closer to Claude Code's IDE integration experience. Happy to make any changes needed for merge.
For what it's worth, this is merged but not yet working in shuvcode. It looks like it will require a fork of the vscode extension to target the shuvcode binary instead of opencode. We will get it tested over the next few days and will provide feedback here.