Skip to content

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 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
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.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 (EditorService)
ctx.terminalsopen / reap terminal tabs (TerminalService)
ctx.workspacesworkspaces & editor tabs (WorkspaceService)
ctx.layoutside-panel collapse state (LayoutService)
ctx.filesread / write / list / watch the filesystem, host-mediated (FileService)
ctx.processpersistent process / PTY sessions that survive restarts (ProcessService)
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)

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)

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