Skip to content

feat(vscode): add a sidebar UI to vscode - #62995

Open
isaaca26 wants to merge 6 commits into
anomalyco:devfrom
isaaca26:vscode-ui
Open

isaaca26 wants to merge 6 commits into
anomalyco:devfrom
isaaca26:vscode-ui

Conversation

@isaaca26

@isaaca26 isaaca26 commented Nov 10, 2026 •

Copy link
Copy Markdown

feat(vscode): open the app in VS Code's secondary sidebar

Issue for this PR

Closes #11176

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The VS Code extension gets an OpenCode view in the secondary sidebar that runs the real app (packages/app), not a copy. It works in the folder open in that window and talks to the same background server the TUI and desktop app share.

Extension (sdks/vscode)

  • sidebar.ts finds or starts the background server with opencode service start and reads its password with opencode service get password.
  • The webview never sees the password. Server requests go to the extension as messages, and the extension adds Basic auth before forwarding them.
  • VS Code only serves extension files to the page itself, so workers can't load their scripts. The extension serves dist/webview read-only on a localhost port for them. Paths aren't decoded, and anything outside the folder gets a 404.
  • The page has a strict CSP with a fresh nonce on every render.
  • With no folder open, the view shows an Open Folder button. In a remote window (SSH, WSL, containers) it shows a notice instead, because the extension runs on the remote and the webview can't reach the files it serves.
  • The app's Settings screen is replaced by VS Code settings (opencode.*), which the webview picks up as they change. Reduce motion follows workbench.reduceMotion, and the fonts follow VS Code's.
  • The existing terminal commands are unchanged.
  • engines.vscode is now ^1.106.0, for the secondary sidebar view container.

Webview (packages/vscode-webview)

A small Vite entry that builds the app into sdks/vscode/dist/webview. It contains the platform object, the message bridge, the worker shim and settings sync.

App

  • The Platform union gets an ide variant for editor extensions.

  • App code never checks for ide. What an editor does differently comes from optional capabilities on the platform:

    • project: the folder the app is locked to
    • openSettings
    • omitPlugins
    • fonts
    • windowID

    Another editor's extension would get the same behavior without changing the app.

  • When project is set:

    • Home and new sessions use only that project.
    • The palette and session search list only its sessions.
    • Project switching, project search and project settings are hidden.
  • Settings links go to the host's settings.

  • The terminal and updater plugins are left out in the editor: VS Code has its own terminal, and the marketplace updates the extension.

  • Window-scoped storage uses the workspace folder as its window ID, so each VS Code window keeps its own tabs.

  • The error page says "Reload" outside desktop.

Other

  • Plugin API: App.platform gains "ide". This is a public API change and needs a release note.
  • gui-plugins: the workspace submenu may overlap its parent menu in narrow windows. Before, it had no room.
  • fixed the corktree popup to add overlap. It was falling off the screen under the narrow vscode side panel

No feature flag. Everything new in the app only runs when the host sets platform.project, which only the IDE platform does, so web and desktop behave as before. The extension ships separately through its own vscode-v* tags.

Not covered yet

  • Remote windows.
  • Following the VS Code color theme.
  • sdks/vscode isn't part of bun run check, so CI doesn't type-check or lint it.

Note

This adds "ide" to a public plugin API type. Existing plugins still compile, but a plugin that checks platform === "web" and treats everything else as desktop will now take the desktop path inside VS Code.

How did you verify your code works?

  • bun run check passes for the whole repo (35 tasks).
  • App unit tests pass (2589).
  • bun typecheck passes in packages/vscode-webview.
  • bun run compile in sdks/vscode passes: type check, lint, webview build and esbuild.
  • I ran the extension in a separate VS Code instance (its own user data and extensions folders) and checked:
    • The app renders in the secondary sidebar against the background server.
    • Sessions load and the titlebar fits the sidebar.
    • Tabs are stored per workspace.
    • Reload re-renders the view.
    • The asset server returns 404 for malformed and .. paths.
  • Not tested:
    • The remote-window notice, since I had no remote environment.
    • The palette's project filtering, which is only type-checked.

Screenshots / recordings

image image image

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Public API: plugin API: App.platform gains "ide" ("web" | "desktop" → "web" | "desktop" | "ide"); compiles for existing plugins, but code that treats "not web" as desktop needs a check

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Nov 10, 2026

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't verify the sidebar end to end. VS Code isn't available here, and starting the background server from source in this sandbox failed for a setup reason unrelated to this PR. What passed: packages/app and packages/vscode-webview type-check (tsc -b), the webview build writes to sdks/vscode/dist/webview, check-types and lint pass in sdks/vscode, and machine.test.ts passes. In the code, opencode service start and opencode service get password exist on dev and print the URL and password the extension expects. Everything new in the app checks capabilities (project, openSettings, omitPlugins, fonts) that only the ide platform sets, so web and desktop should behave as before. The security setup looks reasonable: the proxy only forwards to the server's origin and the password stays in the extension; the asset server listens only on 127.0.0.1, serves files only from dist/webview and answers only GET; the CSP gets a new nonce on each render.

Public API: the plugin API's App.platform changes from "web" | "desktop" to "web" | "desktop" | "ide". Existing plugins keep compiling, but code that assumes "not web means desktop" will treat the IDE as desktop, so this needs a release note. VS Code settings (opencode.*), the opencode.openSettings command and the engines.vscode bump to ^1.106.0 are additions to the extension and break nothing, though users on VS Code below 1.106 won't get updates of the extension. No HTTP, SDK or CLI changes.

Two things worth fixing:

  • sdks/vscode/package-lock.json (3,300 lines) adds a second lockfile next to the existing sdks/vscode/bun.lock. Please remove it.
  • The gui-plugins submenu overlap change and the removed eslint semi rule are outside this feature. Please mention them in the description or split them out.

The remote-window notice and the palette's project filtering are untested, as you noted. A screenshot of the palette in a project with sessions from other projects would help.

  • sdks/vscode/package-lock.json:1: This adds an npm lockfile next to the existing sdks/vscode/bun.lock. The extension is installed and built with bun, so the two will drift apart. Please remove this file.

Comment thread packages/plugin/src/gui/core.ts Resolved

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. The extra sdks/vscode/package-lock.json is gone, which addresses my earlier lockfile point.

The new-session changes are redone cleanly on top of the latest dev: a fixed project now has no projects step to go back to, from either the worktrees step or the new branches step, and the updated test covers both. packages/app and packages/vscode-webview type-check (tsc -b) and the location machine tests pass. I still couldn't run the sidebar itself, because there's no VS Code here.

The plugin API change is the same as before: App.platform gains "ide", so the release-note thread stays open.

Nothing new to flag in these commits.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@isaaca26

Copy link
Copy Markdown
Author

Totally your call, but this could be a good time to publish a new VS Code extension under the Anomaly publisher ID. You could then get Anomaly verified as a publisher, so people installing it know it’s the official one. It might also be worth using the pre-release channel to test new changes before they go out to everyone.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only new commit is a merge of dev. It doesn't change this PR's own diff. packages/app and packages/vscode-webview still type-check (tsc -b), and the location machine tests pass. I still couldn't run the sidebar itself, because VS Code isn't available here. The public API impact is unchanged: App.platform gains "ide", and the description now has a note about it. Nothing new to flag.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]:Official - OpenCode VS Code extension

1 participant