Skip to main content

Module CustomEditorProvider

Expand description

CustomEditorProvider: registers and resolves custom editor contributions.

§CustomEditorProvider (Environment)

Implements CustomEditorProvider for MountainEnvironment, managing registration and lifecycle of custom non-text editors. Coordinates Webview-based editing experiences (SVG editors, diff viewers, etc.) and handles editor resolution, save operations, and provider unregistration.

Uses IPCProvider for RPC communication with Cocoon and integrates with ApplicationState for provider registration persistence.

§Methods

  • RegisterCustomEditorProvider - register extension provider by view type
  • UnregisterCustomEditorProvider - unregister provider
  • OnSaveCustomDocument - workbench → extension save reverse-RPC via $onSaveCustomDocument; returns the sidecar’s error verbatim on failure
  • ResolveCustomEditor - fire-and-forget RPC to populate the webview

§VS Code reference

  • vs/workbench/contrib/customEditor/browser/customEditorService.ts
  • vs/workbench/contrib/customEditor/common/customEditor.ts

Statics§

CUSTOM_EDITOR_REGISTRY 🔒
Process-global custom editor registry: ViewType → SidecarId. Populated by RegisterCustomEditorProvider, consumed by ResolveCustomEditor to route the save/resolve RPC to the correct extension host sidecar.

Functions§

GetRegistry 🔒
LookupSidecarForViewType
Return the sidecar identifier for a registered ViewType, or "cocoon-main" as the canonical fallback.