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 ExtensionContext — ctx. Everything your extension does flows through ctx, and it comes down to three things:
| Group | What it's for |
|---|---|
| Registration | add things to the app — editors, panels, commands, status items, menus, keybindings… |
| Services | read & drive the running app through typed domain services |
| Chrome | ephemeral adornments on host chrome (CenterDock tabs, …) |
| Other | invoke 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).
| Method | Adds |
|---|---|
ctx.registerEditor | an editor (presenter) for a file type |
ctx.registerSidePanel | a left/right column panel |
ctx.registerStatusItem | a status-bar widget |
ctx.registerCommand | a named, invokable action |
ctx.registerKeybinding | a shortcut bound to a command |
ctx.registerMenuItem | a command in an application menu |
ctx.registerContextMenuItem | a command in a surface's context menu |
ctx.registerToolbarItem | a control in an editor/terminal toolbar trailing cluster |
ctx.registerFileType | declarative file metadata |
ctx.registerDockPanelKind | a center-dock tab kind |
ctx.registerSettingsPage | a page in the Settings dialog |
ctx.registerThemePreset | a 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).
| Member | Purpose |
|---|---|
ctx.editors | open files into editor tabs; save / saveAs / closeActive; registerSaveHandler; reactive active-editor state via getState / subscribe (EditorService) |
ctx.terminals | open / reap terminal tabs; tab adornments via setIndicator / bindIndicator (TerminalService); see tab adornments |
ctx.workspaces | workspaces & editor tabs; status / badges via adorn set/clear/bind (WorkspaceService); registerSection for React sections |
ctx.layout | side-panel collapse state (LayoutService) |
ctx.storage | persisted per-extension key/value storage, global & workspace scopes (ExtensionStorageScopes) |
ctx.files | read / write / list / watch the filesystem, host-mediated (FileService) |
ctx.process | persistent process / PTY sessions that survive restarts (ProcessService) |
ctx.processes | live foreground process view per terminal — leader, cwd, idle/busy, optional CPU+memory, surgical kill (ProcessesService) |
ctx.agents | host-computed coding-agent activity + resume hints — sealed detection, exact-or-honest resume (AgentsService) beta |
ctx.search | cross-file content search over the workspace (SearchService) |
ctx.theme | presets + active theme + custom themes (ThemeService) |
ctx.dnd | drag sources + drop targets with typed payloads (DndService) |
ctx.ui | native pickers + toasts + menus + modals (confirm / prompt / showModal) (UiService) |
ctx.net | server-side HTTP client — bypasses browser CORS, reads any response header (NetworkService) |
ctx.system | static host-platform metadata — OS, CPU arch, and Silo version (SystemService) |
ctx.webview | cross-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).
| Topic | Purpose |
|---|---|
| Tab adornments | Leading icons, trailing indicators, and Activity on CenterDock editor/terminal tabs |
| Activity (Design) | ActivityGlyph for the same dots in your own UI |
Other
| Member | Purpose |
|---|---|
ctx.executeCommand | invoke any registered command by id |
ctx.getExtension | consume another extension's published API (ExtensionHandle) |
ctx.extensionId | this extension's id (read-only) |
ctx.subscriptions | the Disposables the host tears down on unload |
useServiceState | React hook to read any service's reactive state (ReactiveService) |
useFocusGroup | React hook for keyboard nav of a focus group — list / menu / toolbar: one tab stop, arrows, the keyboard ring |
focusGroupNextIndex | the pure roving-index helper useFocusGroup runs — for widgets that can't use the hook (e.g. menus) |
Tooltip | styled hover popup matching the host's status-bar tooltip — wrap any button or icon, 600 ms delay, portal-rendered |
path | pure 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.