[PR #5873] feat(ide): IDE integration with Cursor/VSCode and improved UX #11627

Open
opened 2026-02-16 18:16:31 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5873

State: open
Merged: No


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, events
  • src/ide/connection.ts - WebSocket client with JSON-RPC 2.0
  • src/mcp/ws.ts - WebSocket transport for MCP

UX Improvements

  • local.tsx - Selection state with formatted() helper showing line count
  • home.tsx - IDE/selection display in home footer
  • footer.tsx - Selection display in session footer
  • prompt/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

  1. Install the OpenCode extension in Cursor/VSCode
  2. Launch OpenCode in terminal
  3. Connect to IDE via /status
  4. Select text in editor
  5. Verify footer shows: [] 6 lines
  6. 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
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5873 **State:** open **Merged:** No --- ## 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, events - `src/ide/connection.ts` - WebSocket client with JSON-RPC 2.0 - `src/mcp/ws.ts` - WebSocket transport for MCP ### UX Improvements - `local.tsx` - Selection state with `formatted()` helper showing line count - `home.tsx` - IDE/selection display in home footer - `footer.tsx` - Selection display in session footer - `prompt/index.tsx` - Synthetic parts for invisible context ## Configuration Add to `opencode.json`: ```json { "ide": { "lockfile_dir": "~/.claude/ide/", "auth_header_name": "x-claude-code-ide-authorization" } } ``` ## Testing 1. Install the OpenCode extension in Cursor/VSCode 2. Launch OpenCode in terminal 3. Connect to IDE via `/status` 4. Select text in editor 5. Verify footer shows: `[] 6 lines` 6. 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
yindo added the pull-request label 2026-02-16 18:16:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11627