OpenCode: VSCode Extension for OpenCode
Last updated: 2026-08-31
--- title: VSCode Extension for OpenCode description: Learn to install and use the OpenCode VSCode extension for in-editor AI collaboration order: 6 lang: en
OpenCode can be used as a VSCode extension for in-editor AI collaboration.
1. What You Will Learn
- VSCode extension installation
- In-editor usage
- Differences from the terminal version
- Common operations
2. Install Extension
(1) From Extension Marketplace
- Open VSCode
- Click the Extensions icon (or press
Ctrl+Shift+X) - Search for OpenCode
- Click Install
(2) From Command Line
BASH
code --install-extension anomalyco.opencode
3. Configure Connection
After installation, configure the API connection:
- Open Command Palette (
Ctrl+Shift+P) - Search OpenCode: Connect Provider
- Select a provider and enter API Key
4. Basic Usage
(1) Open OpenCode Panel
Click the OpenCode icon in the sidebar, or use Command Palette: OpenCode: Open Panel.
(2) Chat Interaction
Type natural language in the panel:
TEXT
📖 Display only
Explain the main logic in the currently open file
(3) File Operations
- AI can directly read files opened in VSCode
- Modified code can be auto-applied to the editor
- Supports diff preview
5. VSCode Extension vs Terminal TUI
| Feature | VSCode Extension | Terminal TUI |
|---|---|---|
| Installation | Extension marketplace | Command line |
| Interface | Graphical | Terminal character UI |
| File integration | Direct editor access | Project directory |
| Code preview | Diff view | Terminal display |
| Shortcuts | Editor command palette | / slash commands |
| Best for | Daily development | Server/automation |
6. Common Shortcuts
| Operation | Method |
|---|---|
| Open panel | Sidebar icon / Command Palette |
| Send message | Enter |
| Switch model | Command Palette → OpenCode: Switch Model |
| Undo change | Command Palette → OpenCode: Undo |
| New session | Command Palette → OpenCode: New Session |
❓ FAQ
Q Can the VSCode extension and terminal version be used simultaneously?
A Yes, but not recommended on the same project. Both share project files—simultaneous modifications may cause conflicts.
Q What features does the VSCode extension support?
A Core features match the terminal version—code analysis, file modification, command execution. VSCode adds graphical diff preview and editor integration.
Q Alice prefers VSCode, Bob prefers terminal—can they collaborate?
A Yes. They use different interfaces on the same project. OpenCode's changes are reflected in project files. Use Git to manage code changes.
📖 Summary
- VSCode extension provides a graphical experience
- Install from the Extension Marketplace by searching OpenCode
- Core features match terminal version with added diff preview
- Best for developers who prefer IDE workflows
📝 Exercises
-
Basic: Install the OpenCode extension in VSCode and complete a conversation.
-
Intermediate: Use the VSCode extension to have AI modify code, then confirm via diff preview.
-
Advanced: Compare VSCode extension and terminal TUI experiences, listing pros and cons of each.