Skip to content

feat(ide): run VS Code extensions with code in an extension host process (#259) - #291

Merged
aMonteSl merged 2 commits into
idefrom
claude/project-thread-keii8k
Nov 27, 2026
Merged

aMonteSl merged 2 commits into
idefrom
claude/project-thread-keii8k

Conversation

@aMonteSl

@aMonteSl aMonteSl commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Adrián · project thread

Story #259 of epic #251: extensions with code now run in the IDE.

What changes

  • Extension host (src/extensionHost/, new Vite target out/extensionHost/index.cjs): a Node child process per window on Electron's own Node. It answers require('vscode') with an API object made for each extension, activates on declared and implicit events (onCommand:, onView:, onLanguage:) after extensionDependencies, reports activation state and errors, and calls deactivate() on close.
  • The vscode API (api.ts, types.ts): commands; window (messages with buttons, modal messages as native dialogs, showQuickPick, showInputBox, createQuickPick, createInputBox, open/save dialogs, withProgress, status bar items, output and log channels); workspace (configuration with contributes.configuration defaults, fs, findFiles, openTextDocument, file watchers, content providers, trust); env (clipboard, openExternal, random machineId, telemetry always off); extensions; l10n; ExtensionContext (global/workspace state, secrets in the OS store, storage and log folders); the API's classes and enums with VS Code's numbers. Missing API is logged once per extension in the Extensions output channel and replaced by inert stand-ins (inert.ts) instead of throwing.
  • Main (extensionHostManager.ts): starts the host when the workbench is ready, restarts it when extensions, the folder or its trust change and after crashes (3 in 5 minutes, then asks), forwards UI requests to the renderer and checks what the host asks (files only inside the folder, links http/https/mailto). Extension settings live in <userData>/extensions/settings.json. The host is unpacked from the asar in installers.
  • Renderer (hostBridge.ts): messages, pickers, input boxes (masked for passwords), progress, status bar items, setContext, contributed commands in the palette, VS Code command ids mapped onto the IDE's (workbench.action.files.save → file.save...), onLanguage: as files open. Developer: Restart Extension Host.
  • Docs: docs/ide/extensions.md (host section, security, how to try it), README security row.

Next: #260 (documents of the editor, diagnostics, language features).

Tests

  • npm run test --workspace=code-xr-ide: typecheck, lint, 726 tests pass. New test/extensionHost.test.ts runs a real host process with three test extensions (activation by event, command and dependency, failed activation, messages, configuration writes, state on disk, workbench commands, missing API, findFiles, deactivate).
  • npm run smoke: OK.
  • Real IDE (Electron under xvfb) with five of Microsoft's vscode-extension-samples compiled from source and installed as .vsix: helloworld-minimal (palette command, message), progress (* activation, progress notification), statusbar (status bar item), configuration (two quick picks, then getConfiguration().update written to the settings file) and quickinput (showQuickPick and its messages).

…ess (#259)

- src/extensionHost/: a Node child process per window (ELECTRON_RUN_AS_NODE)
  that answers require('vscode') with a per-extension API, activates on
  declared and implicit events after dependencies, and deactivates on close.
- The vscode API: commands, window (messages, quick picks, input boxes,
  dialogs, progress, status bar items, output channels), workspace
  (configuration, fs, findFiles, openTextDocument, watchers), env, extensions,
  l10n, ExtensionContext (state, secrets, storage) and the API's classes and
  enums. Missing API is reported once in the Extensions channel and replaced
  by inert stand-ins instead of throwing.
- main: ExtensionHostManager (start, restart on changes and crashes, stop),
  the extensions' own settings file, secrets in the OS store, dialogs,
  clipboard, links, and the UI requests forwarded to the renderer.
- renderer: the host bridge (messages with buttons, pickers, input boxes,
  progress, status bar items, contributed commands in the palette, VS Code
  command ids mapped onto the IDE's) and onLanguage activation.
- Tests: protocol, API values, configuration, documents, and a real host
  process running three test extensions.
@aMonteSl aMonteSl self-assigned this Nov 27, 2026
…ension host (#259)

On Windows Uri.fsPath lower-cases the drive letter, so asRelativePath and
getWorkspaceFolder failed against the folder as the main process spells it.
@aMonteSl
aMonteSl merged commit b3fbd4e into ide Nov 27, 2026
15 checks passed
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.

2 participants