Using ctx stable
The domains below are available now. For what's still being designed (
ctx.ui,ctx.settings,ctx.storage,ctx.theme, …) 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 |
| 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.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 (EditorService) |
ctx.terminals | open / reap terminal tabs (TerminalService) |
ctx.workspaces | workspaces & editor tabs (WorkspaceService) |
ctx.layout | side-panel collapse state (LayoutService) |
ctx.files | read / write / list / watch the filesystem, host-mediated (FileService) |
ctx.process | persistent process / PTY sessions that survive restarts (ProcessService) |
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) |
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) |
Looking for a type? The full, generated type reference lists every interface and type alias in the SDK.