./start-dev.shThis will:
- Build the extension
- Start watch mode
- Show you what to do next
In Cursor/VSCode:
- Look at the left sidebar for the Run and Debug icon (
▶️ 🐛) - Click it (or press
Cmd+Shift+Don Mac,Ctrl+Shift+Don Windows/Linux) - At the top of that panel, you'll see a dropdown that says "Run Extension"
- Click the green play button next to it (or just press
F5)
A new window called "Extension Development Host" will open.
In that new window:
- Look at the left sidebar (Activity Bar)
- Find the OpenCode icon (looks like a square/box)
- Click the icon
- The sidebar opens with "Hello from Opencode" 🎉
If the script doesn't work or you prefer manual control:
npm run buildOpen a terminal and run:
npm run watchKeep this terminal open! It will automatically rebuild when you make changes.
- Open the Run and Debug panel (
Cmd+Shift+D/Ctrl+Shift+D) - Select "Run Extension" from dropdown
- Press F5 or click the green play button
In the Extension Development Host window:
- Look for OpenCode icon in the Activity Bar (left side)
- Click it to open the sidebar panel
- Check if the terminal shows "Starting incremental compilation..." - if not,
npm run watchisn't running - Try the manual steps above instead
- Check the Debug Console: View > Debug Console
- Look for "OpenCode extension is now active!" message
- If not there, check that
dist/extension.jsexists - Try: Developer: Reload Window (in Command Palette)
- Open Developer Tools: Command Palette > "Developer: Toggle Developer Tools"
- Check Console for errors
- Verify
out/main.jsandout/main.cssexist - Try rebuilding:
npm run clean && npm run build
For extension code changes:
- Save your file
- In Extension Development Host, press
Cmd+R(Mac) orCtrl+R(Windows/Linux) - Or: Command Palette > "Developer: Reload Window"
For webview (React) changes:
- Should reload automatically
- If not, check that watch mode is running
- Check terminal for Vite errors
When everything works:
-
Main VSCode/Cursor window:
- Terminal shows watch mode running
- Debug Console shows compilation messages
-
Extension Development Host window:
- OpenCode icon in Activity Bar (left side)
- Click icon → Sidebar opens
- Shows "Hello from Opencode"
-
Debug Console (in Extension Development Host):
OpenCode extension is now active! OpenCode webview provider registered
- First time? Run
./start-dev.sh- it does everything for you - Developing? Keep watch mode running, just press
Cmd+Rin Extension Development Host when you change extension code - React changes? Just save - they hot reload automatically!
- Stuck? See TROUBLESHOOTING.md for detailed help
src/extension.ts- Extension entry pointsrc/OpenCodeViewProvider.ts- Webview provider logicsrc/webview/App.tsx- React UIsrc/webview/App.css- Styles
After editing extension code, press Cmd+R in Extension Development Host.
After editing webview code, changes auto-reload!