~/content/ide

IDE

The OpenCode extension for VS Code, Cursor, and other IDEs

last_updated: "2026-01-20"

OpenCode 集成了 VS Code、Cursor 或任何支持终端的 IDE。只需在终端中运行 opencode 即可开始。


##用法

  • 快速启动: 使用 Cmd+Esc (Mac) 或 Ctrl+Esc (Windows/Linux) 在拆分终端视图中打开 OpenCode,或者如果已有一个终端会话正在运行,则聚焦于现有终端会话。
  • 新会话: 使用 Cmd+Shift+Esc (Mac) 或 Ctrl+Shift+Esc (Windows/Linux) 启动新的 OpenCode 终端会话,即使已经有一个会话打开。您也可以单击 UI 中的 OpenCode 按钮。
  • 上下文感知: 自动与 OpenCode 共享您当前的选择或选项卡。
  • 文件引用快捷方式: 使用 Cmd+Option+K (Mac) 或 Alt+Ctrl+K (Linux/Windows) 插入文件引用。 例如,@File#L37-42

##安装

要在 VS Code 和流行的分支(如 Cursor、Windsurf、VSCodium)上安装 OpenCode:

  1. 打开 VS Code
  2. 打开集成终端
  3. 运行 opencode - 扩展程序会自动安装

另一方面,如果您想在使用 TUI 运行 /editor/export 时使用自己的 IDE,则需要设置 export EDITOR="code --wait"了解更多


###手动安装

在扩展市场中搜索 OpenCode,然后单击安装


###故障排除

如果扩展程序无法自动安装:

  • 确保您在集成终端中运行 opencode
  • 确认已安装 IDE 的 CLI:
    • 对于 VS Code:code 命令
    • 对于 Cursor:cursor 命令
    • 对于 Windsurf:windsurf 命令
    • 对于 VSCodium:codium 命令
    • 如果没有,请运行 Cmd+Shift+P (Mac) 或 Ctrl+Shift+P (Windows/Linux) 并搜索“Shell Command: Install 'code' command in PATH”(或您的 IDE 的等效命令)
  • 确保 VS Code 具有安装扩展程序的权限
Comments (Coming Soon)

Configure Giscus in environment variables to enable comments.