OpenCode in VS Code: the extension, shortcuts and Remote-SSH
OpenCode's VS Code extension (sst-dev.opencode 1.0.0): install, shortcuts, @file references, the --port error on OpenCode 2, the Beta panel, Remote-SSH and WSL.
OpenCode’s VS Code extension is opencode, ID sst-dev.opencode, version 1.0.0 (October 14, 2026), on the VS Code Marketplace and Open VSX, so it also installs in Cursor. It is not a chat panel: it opens a terminal beside your editor and runs opencode in it, so you need the OpenCode CLI installed first. Cmd+Esc (Ctrl+Esc on Windows and Linux) opens or focuses that terminal, Cmd+Shift+Esc (Ctrl+Shift+Esc) opens another, and Cmd+Option+K (Ctrl+Alt+K) types an @file reference for the open file and selected lines into it. Version 1.0.0 is the one that works with OpenCode 2; older copies fail with Unrecognized flag: --port, and the separate OpenCode Beta panel extension is no longer maintained. In a Remote-SSH, WSL or dev container window, the extension and the terminal run on the remote side, so OpenCode has to be installed there.
The extension, and what it does
There is one current extension, published as SST (sst-dev) from the sdks/vscode folder of OpenCode’s repository. As of November 23, 2026 the Marketplace listing shows 1,359,131 installs, and Open VSX lists it as a verified extension at the same version. It needs VS Code 1.94 or later and calls itself “an early release”.
It adds three commands and nothing else: no settings, no sidebar, no sign-in. Everything after the terminal opens is the ordinary OpenCode terminal interface, with your providers, sessions and config.
| Command | macOS | Windows, Linux | What it does |
|---|---|---|---|
Open opencode | Cmd+Esc | Ctrl+Esc | Focuses the terminal named opencode, or opens one in an editor split beside the current file and runs opencode |
Open opencode in new tab | Cmd+Shift+Esc | Ctrl+Shift+Esc | Always opens a new one; also the OpenCode button in the editor’s title bar |
Add Filepath to Terminal | Cmd+Option+K | Ctrl+Alt+K | Types @path for the open file, with the selected lines, into the OpenCode terminal without sending it |
The extension types the bare word opencode into a shell, so it runs whichever opencode that shell finds first on its PATH, version 1 or 2. If you would rather run it yourself, opening VS Code’s integrated terminal and typing opencode gives you the same thing; the extension adds the split placement, the shortcuts and the file references.
Install it
Install OpenCode itself first. Version 2’s install line on macOS and Linux is curl -fsSL https://opencode.ai/v2/install | bash, or npm install -g @opencode/cli; on Windows, where OpenCode says “Windows package managers are not supported”, it offers standalone binaries instead. The trap between the two versions’ installers is in installing OpenCode on Linux. Then the extension:
code --install-extension sst-dev.opencode
code --list-extensions --show-versions | grep opencode # sst-dev.opencode@1.0.0CopiedOr search the Extensions view for opencode and pick the one by SST. Cursor installs from Open VSX, where the same ID is published. The version 1 docs say the extension installs itself the first time you run opencode in the integrated terminal; a report on 1.18.31 found that it did not, so install it by hand.
Don’t confuse it with OpenCode Beta (sst-dev.opencode-v2, 0.1.1, December 2025), a chat panel in the sidebar with about 62,000 installs. With OpenCode 2 it fails with Failed to open OpenCode panel: Timeout waiting for server to start after 15000ms, and an OpenCode maintainer closed that report on October 14: “The ‘OpenCode Beta’ extension (sst-dev.opencode-v2) is no longer maintained and won’t be updated for V2.” Uninstall it and use sst-dev.opencode.
Sharing the open file and the selection
Select some lines, press Cmd+Option+K (Ctrl+Alt+K), and the extension types a reference such as @src/auth.ts#L20-45 at OpenCode’s prompt, then you add your question. Two conditions apply, both from the extension’s source: the file must be inside the open workspace folder, and the terminal VS Code considers active must be the one named opencode. Otherwise the shortcut does nothing and says nothing.
On OpenCode 2 there is a catch in that reference. The L is version 1’s syntax; version 2’s terminal interface writes ranges as @src/auth.ts#20-45. The pull request that fixed the extension, merged on October 31, puts it this way: a mention with the L “does not match what the TUI’s own autocomplete produces (@src/app.ts#5-10), and the typed mention is not recognized as a file reference.” The published 1.0.0, from October 14, predates that fix and still types the L, and as of November 23 no newer version is on either marketplace. Until one is, delete the L before sending, or type @ in OpenCode, pick the file from its search, and add #20-45 yourself.
What the listing calls “Context Awareness”, the current file or selection appearing in OpenCode on its own, is gone. Earlier versions started opencode --port with a random port and, once the interface answered, typed In @file#L… into the prompt through that port. Version 1.0.0 dropped this along with the --port flag, so nothing of the editor reaches OpenCode until you press the shortcut.
The other direction works through your EDITOR. OpenCode 2 lets you edit the current prompt in an external editor with Ctrl+X then E, or /editor, once VISUAL or EDITOR is set; its docs show only nvim. The version 1 IDE page gives VS Code’s form, for /editor and /export, which needs --wait so OpenCode waits for the tab to close:
export EDITOR="code --wait"CopiedOpenCode 1 and OpenCode 2 in VS Code
As of November 23, 2026 the newest releases are OpenCode 2.4.1, published that day, and OpenCode 1.19.6, from November 17. What differs in VS Code:
| OpenCode 1 | OpenCode 2 | |
|---|---|---|
Docs page | opencode.ai/v1/docs/ide | None. opencode.ai/docs/ide still serves the version 1 page, under the banner “These are the docs for OpenCode V1.” |
Extension before 1.0.0 | Works, and puts the open file in the prompt on launch | Fails: Unrecognized flag: --port in command opencode |
Extension 1.0.0 | Works; no file in the prompt on launch | Works |
Line ranges | @file#L37-42, what the extension types | @file#37-42; the extension’s form is not recognized |
The --port failure was reported several times after OpenCode 2 shipped; a maintainer answered it on October 14 with “Fixed in the VS Code extension v1.0.0, now on the Marketplace and Open VSX.” If you see it, update the extension, and in a remote window update the copy on the host. The extension’s file in the repository is stamped with the CLI’s version (2.4.1 at that tag), which is not what the marketplaces ship. Moving your sessions, config and plugins across is in the OpenCode 1 to 2 upgrade.
Remote-SSH, WSL and dev containers
The extension is a workspace extension, and VS Code runs those “on the remote machine / environment” when the folder is remote. Its terminal is remote too: over SSH, VS Code says any terminal you open will “automatically run on the remote host rather than locally.” So OpenCode runs on the server, edits the server’s files, and uses the server account’s config, provider keys and sessions, not your laptop’s.
- Install both on the host. OpenCode with the install line above, in the account you connect as; the extension by selecting Install on its dimmed entry under Local - Installed, or for every host with
"remote.SSH.defaultExtensions": ["sst-dev.opencode"]in your settings. - Connect a provider on the server. Your laptop’s saved keys are not there; connecting one on a machine with no browser is in installing OpenCode on Linux.
- WSL: open the folder from the WSL shell with
code .; the terminal then runs in WSL, so install the Linux build of OpenCode inside the distribution. - Dev containers: the same rule: the extension and its terminal run in the container, so OpenCode must be installed there.
On a server, OpenCode 2 keeps its sessions in a shared background service that stays running after the terminal that started it has closed, so closing the VS Code window does not stop it. Connecting to it from OpenCode Desktop or a browser or phone are the alternatives to a VS Code window.
Other ways to use OpenCode from an editor
VS Code’s own agent harness docs of November 18, 2026 list Copilot, Local, Claude and Codex, and not OpenCode. Editors that speak the Agent Client Protocol can run OpenCode as their agent through opencode acp; OpenCode’s docs give the settings for Zed only and say other clients use the same command with their own field names. What ACP is and which editors support it is in what is ACP. Anthropic and OpenAI ship editor panels of their own for their agents, covered in Claude Code in VS Code and Codex in VS Code.
When it goes wrong
Unrecognized flag: --port in command opencodeAn extension older than 1.0.0 starting OpenCode 2. Update the extension; in a remote window, the host’s copy.Failed to open OpenCode panel: Timeout waiting for server to start after 15000msThe unmaintained OpenCode Beta extension. Remove it and installsst-dev.opencode.opencode: command not foundin the new terminal. OpenCode is not on that shell’sPATH, or, in a remote window, not installed on the host. If you installed it while VS Code was open, a terminal opened before the install may not see it yet; open a new one.- The wrong version starts. Run
which -a opencodeandopencode --versionin the VS Code terminal: an old version 1 earlier on thePATHwins. - Cmd+Option+K does nothing. The extension types only into the active terminal, and only when that is the one named
opencode, so click into the OpenCode terminal once to make it the active one; and check the file is inside the opened folder. - The reference is typed but OpenCode does not treat it as a file. The
#Lform on OpenCode 2, above: remove theL.