To use OpenCode in VS Code, the simplest method is exactly what the OpenCode docs describe: open VS Code, open the integrated terminal, and run opencode. OpenCode’s VS Code extension can install automatically from that first run, and after that you can treat OpenCode like a “terminal-native assistant” that lives inside your editor without forcing a separate chat panel. This approach is nice because it matches how developers already work: your repo is open in VS Code, your terminal is already pointed at the project directory, and opencode starts a project-scoped session where file references and code navigation behave predictably.
Once it’s installed, the VS Code integration is mainly about speed and context. OpenCode supports quick launch shortcuts so you can jump to an existing OpenCode terminal session or spin up a new one without hunting for the terminal tab. On macOS the default is Cmd+Esc to open/focus OpenCode and Cmd+Shift+Esc to start a new session; on Windows/Linux it’s Ctrl+Esc and Ctrl+Shift+Esc. The extension also focuses on “context awareness”: it can automatically share your current selection or active tab context with OpenCode, which makes prompts more concrete than “look at the auth code.” File references are another big deal: you can insert references like @File#L37-42 via shortcuts (Cmd+Option+K on macOS or Alt+Ctrl+K on Windows/Linux). That gives the agent an exact slice of code to read and comment on, which is the difference between useful diffs and generic advice.
If you want OpenCode to open your editor from inside the TUI (for example when you trigger /editor or /export), configure the EDITOR environment variable so OpenCode knows how to invoke VS Code in a blocking mode: export EDITOR="code --wait". The --wait part matters because some editors fork and return immediately; OpenCode expects the process to block until you finish editing. In practice, this becomes a tight workflow: ask OpenCode for a plan, let it generate a patch, jump into a file via VS Code, and return to the TUI to run tests or iterate. That’s especially handy when you’re working on a codebase with multiple moving parts—say a RAG service that embeds documents, stores vectors in Milvus or Zilliz Cloud, and exposes a query API. You can keep VS Code for code navigation and refactoring, while OpenCode helps you thread the needle across configs, scripts, and integration points—without losing your place or your terminal-driven feedback loop.
