Skip to content

Using ctx stable

The domains below are available now. For what's still being designed (ctx.settings, ctx.secrets, …) see the Roadmap.

You write an Extension and the host calls its activate(ctx) once, handing you an ExtensionContextctx. Everything your extension does flows through ctx, and it comes down to three things:

GroupWhat it's for
Registrationadd things to the app — editors, panels, commands, status items, menus, keybindings…
Servicesread & drive the running app through typed domain services
Chromeephemeral adornments on host chrome (CenterDock tabs, …)
Otherinvoke commands; consume other extensions' APIs; identity

New here? Start with the guide. Otherwise drill into a method below — each page has the signature, an example, and links down to the type definitions.

Registration

Add things to the app. Each method takes a typed object and returns a Disposable (the host also tracks it on ctx.subscriptions, so teardown is automatic).

MethodAdds
ctx.registerEditoran editor (presenter) for a file type
ctx.registerSidePanela left/right column panel
ctx.registerStatusItema status-bar widget
ctx.registerCommanda named, invokable action
ctx.registerKeybindinga shortcut bound to a command
ctx.registerMenuItema command in an application menu
ctx.registerContextMenuItema command in a surface's context menu
ctx.registerToolbarItema control in an editor/terminal toolbar trailing cluster
ctx.registerFileTypedeclarative file metadata
ctx.registerDockPanelKinda center-dock tab kind
ctx.registerSettingsPagea page in the Settings dialog
ctx.registerThemePreseta selectable theme in the picker

Services

Read and drive the running app through typed domain services — never by importing the store or touching the platform directly. Opening files lives on ctx.editors (not ctx.workspaces).

MemberPurpose
ctx.editorsopen files into editor tabs; save / saveAs / closeActive; registerSaveHandler; reactive active-editor state via getState / subscribe (EditorService)
ctx.terminalsopen / reap terminal tabs; tab adornments via setIndicator / bindIndicator (TerminalService); see tab adornments
ctx.workspacesworkspaces & editor tabs; status / badges via adorn set/clear/bind (WorkspaceService); registerSection for React sections
ctx.layoutside-panel collapse state (LayoutService)
ctx.storagepersisted per-extension key/value storage, global & workspace scopes (ExtensionStorageScopes)
ctx.filesread / write / list / watch the filesystem, host-mediated (FileService)
ctx.processpersistent process / PTY sessions that survive restarts (ProcessService)
ctx.processeslive foreground process view per terminal — leader, cwd, idle/busy, optional CPU+memory, surgical kill (ProcessesService)
ctx.agentshost-computed coding-agent activity + resume hints — sealed detection, exact-or-honest resume (AgentsService) beta
ctx.searchcross-file content search over the workspace (SearchService)
ctx.themepresets + active theme + custom themes (ThemeService)
ctx.dnddrag sources + drop targets with typed payloads (DndService)
ctx.uinative pickers + toasts + menus + modals (confirm / prompt / showModal) (UiService)
ctx.netserver-side HTTP client — bypasses browser CORS, reads any response header (NetworkService)
ctx.systemstatic host-platform metadata — OS, CPU arch, and Silo version (SystemService)
ctx.webviewcross-origin iframe bridge — DOM access, navigation, element picking, native pixel capture, permission-gated (WebviewService)

Chrome

Pin ephemeral signals onto host chrome (not a ctx.* service of its own — verbs live on ctx.editors / ctx.terminals / ctx.workspaces).

TopicPurpose
Tab adornmentsLeading icons, trailing indicators, and Activity on CenterDock editor/terminal tabs
Activity (Design)ActivityGlyph for the same dots in your own UI

Other

MemberPurpose
ctx.executeCommandinvoke any registered command by id
ctx.getExtensionconsume another extension's published API (ExtensionHandle)
ctx.extensionIdthis extension's id (read-only)
ctx.subscriptionsthe Disposables the host tears down on unload
useServiceStateReact hook to read any service's reactive state (ReactiveService)
useFocusGroupReact hook for keyboard nav of a focus group — list / menu / toolbar: one tab stop, arrows, the keyboard ring
focusGroupNextIndexthe pure roving-index helper useFocusGroup runs — for widgets that can't use the hook (e.g. menus)
Tooltipstyled hover popup matching the host's status-bar tooltip — wrap any button or icon, 600 ms delay, portal-rendered
pathpure path utilities (join, dirname, basename, extname, relative, isAbsolute, normalize) — replaces node:path
Event<T>subscribable event type (VS Code convention): (listener) => Disposable

Looking for a type? The full, generated type reference lists every interface and type alias in the SDK.