-
Install dependencies (if you haven't already):
npm install
-
Build the extension:
npm run build
-
Start watch mode (in a terminal):
npm run watch
Keep this terminal running - it will rebuild automatically when you make changes.
-
Press F5 in VSCode/Cursor
- In the "Run and Debug" dropdown, select "Run Extension"
- Press F5 or click the green play button
- A new "Extension Development Host" window will open
-
Open the OpenCode sidebar:
- In the new window, look for the OpenCode icon in the Activity Bar (left sidebar)
- Click it to open the OpenCode panel
- You should see "Hello from Opencode"
- Make changes to files in
src/(e.g.,extension.ts,OpenCodeViewProvider.ts) - Save the file
- In the Extension Development Host window:
- Press
Cmd+R(Mac) orCtrl+R(Windows/Linux) - Or open Command Palette (
Cmd+Shift+P) and run "Developer: Reload Window"
- Press
- Make changes to files in
src/webview/(e.g.,App.tsx,App.css) - Save the file
- Changes should hot-reload automatically in the sidebar!
- No need to reload the window
- Set breakpoints in
src/extension.tsorsrc/OpenCodeViewProvider.ts - Debug panel will show variables and call stack
- In the Extension Development Host window, open Command Palette
- Run "Developer: Toggle Developer Tools"
- In the Console, select "active frame" from the dropdown
- Now you can debug the React code, see console.logs, etc.
npm run buildThis creates optimized builds in:
dist/- Extension codeout/- Webview UI
- Check the Debug Console in the main VSCode window for errors
- Make sure
npm run buildcompleted successfully - Try closing and reopening the Extension Development Host window
- Open Developer Tools (Command Palette > "Developer: Toggle Developer Tools")
- Check Console for errors
- Make sure
out/main.jsandout/main.cssexist
- Make sure
npm run watchis running (it starts automatically with F5) - Check the Terminal panel in the main VSCode window
- Try manually running
npm run watchin a terminal