|
| 1 | +# OpenCode Companion for JetBrains IDEs |
| 2 | + |
| 3 | +Integrates the [OpenCode](https://opencode.ai) AI coding assistant into IntelliJ-based IDEs. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### Server lifecycle management |
| 8 | + |
| 9 | +The plugin can launch, monitor, and stop the OpenCode server for you. |
| 10 | + |
| 11 | +- **Start / Stop** — Start the server from the tool window with a single click. The plugin spawns |
| 12 | + `opencode serve --port <port>` in the project directory. |
| 13 | +- **Auto-detect a running server** — If OpenCode is already running on the configured port (e.g. started from the |
| 14 | + terminal), the plugin connects to it automatically without taking ownership of the process. |
| 15 | + |
| 16 | +Once the server is running the plugin connects over SSE (Server-Sent Events) to receive real-time events. |
| 17 | + |
| 18 | +### Session list |
| 19 | + |
| 20 | +The **Session changes** panel lists all root sessions. Each row shows: |
| 21 | + |
| 22 | +- Session title and a short description |
| 23 | +- A spinner while the session is actively running |
| 24 | +- The number of files being tracked in that session |
| 25 | + |
| 26 | +Clicking a session row makes it the active session; the file list updates to show only that session's changes. |
| 27 | + |
| 28 | +### Modified-files list |
| 29 | + |
| 30 | +The **Files** pane shows every file touched by the selected session: |
| 31 | + |
| 32 | +| State | Visual | |
| 33 | +|----------|----------------------------| |
| 34 | +| Modified | Bold filename | |
| 35 | +| Added | Green filename | |
| 36 | +| Deleted | Red strikethrough filename | |
| 37 | + |
| 38 | +Interact with the list: |
| 39 | + |
| 40 | +- **Double-click** a file — opens a diff view (see below) |
| 41 | +- **Right-click** — context menu with _Jump to Source_ and _Open Diff_ |
| 42 | +- **F4** (or IDE's _Jump to Source_ shortcut) — navigate directly to the file in the editor |
| 43 | + |
| 44 | +### Inline diff in the editor |
| 45 | + |
| 46 | +While a session is active, changed lines are highlighted inlined in the editor: |
| 47 | + |
| 48 | +- **Added lines** — green background highlight |
| 49 | +- **Removed lines** — rendered as red inlay blocks above the insertion point, showing the original content that was |
| 50 | + deleted |
| 51 | + |
| 52 | +_Due to OpenCode limitations, only the last write will be shown._ |
| 53 | + |
| 54 | +This feature can be toggled in settings. |
| 55 | + |
| 56 | +### Diff view of modified files |
| 57 | + |
| 58 | +Double-clicking a file in the modified-files list opens a standard JetBrains **diff editor tab** comparing: |
| 59 | + |
| 60 | +- **Left side** — the session baseline (the content before the agent started making changes) |
| 61 | +- **Middle** - The current file on disk |
| 62 | +- **Right side** — The changes the AI had made to the file |
| 63 | + |
| 64 | +### Send selection to TUI |
| 65 | + |
| 66 | +Share code from the editor directly with OpenCode's prompt input: |
| 67 | + |
| 68 | +- Select any code in the editor |
| 69 | +- Use **Send Selection to OpenCode** from the right-click context menu |
| 70 | +- The selection is sent as a fenced code block (with filename and line range) to the active TUI session's prompt input |
| 71 | + buffer |
| 72 | + |
| 73 | +The text is appended — not submitted — so you retain full control before pressing Enter in the TUI. |
| 74 | + |
| 75 | +You can also send file and folder paths to the TUI by right-clicking them in the project view. |
| 76 | + |
| 77 | +### Open in browser |
| 78 | + |
| 79 | +The **Open in Browser** toolbar button opens the OpenCode web UI in your default browser. |
| 80 | + |
| 81 | +### New session in TUI |
| 82 | + |
| 83 | +The **New Session** toolbar button creates a new OpenCode session and immediately switches the active TUI instance to |
| 84 | +it. |
| 85 | + |
| 86 | +### Permission prompts |
| 87 | + |
| 88 | +When any agent requests permission, a prompt appears at the bottom of |
| 89 | +the panel with three choices: |
| 90 | + |
| 91 | +- **Allow** — permit this one request |
| 92 | +- **Allow Always** — permit this type of request for the rest of the session |
| 93 | +- **Reject** — deny the request |
| 94 | + |
| 95 | +Responses are sent back to the server immediately. |
| 96 | + |
| 97 | +## Requirements |
| 98 | + |
| 99 | +- A JetBrains IDE based on IntelliJ Platform 2023.3 or later |
| 100 | +- [OpenCode CLI](https://opencode.ai/docs) installed and on `PATH` (or the path configured in settings) |
0 commit comments