Files
ClosedCode/packages/web/src/content/docs/zh-tw/ide.mdx
T

49 lines
1.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: IDE
description: 適用於 VS Code、Cursor 及其他 IDE 的 OpenCode 擴充功能
---
OpenCode 可與 VS Code、Cursor 或任何支援終端機的 IDE 整合。只需在終端機中執行 `opencode` 即可開始使用。
---
## 用法
- **快速啟動**:使用 `Cmd+Esc`(Mac)或 `Ctrl+Esc`(Windows/Linux)在分割終端機視圖中開啟 OpenCode,如果已有終端機工作階段正在執行,則會自動聚焦到該工作階段。
- **新建工作階段**:使用 `Cmd+Shift+Esc`(Mac)或 `Ctrl+Shift+Esc`(Windows/Linux)啟動新的 OpenCode 終端機工作階段,即使已有工作階段在執行也會新建。您也可以點選介面中的 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"`。[了解更多](/docs/tui/#editor-setup)。
---
### 手動安裝
在擴充功能商店中搜尋 **OpenCode**,然後點選 **Install**。
---
### 疑難排解
如果擴充功能未能自動安裝:
- 確保您是在整合終端機中執行的 `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 有權限安裝擴充功能