Interface: ExtensionContext
Defined in: packages/sdk/src/types.ts:369
The object handed to Extension.activate. It is the only sanctioned way an extension touches the running app: register contributions, invoke commands, and read/drive state through the typed consumer services. Every register* call returns a Disposable and is also tracked on ExtensionContext.subscriptions.
Properties
extensionId
readonly extensionId: string;Defined in: packages/sdk/src/types.ts:371
The activating extension's id (its Extension.id).
subscriptions
readonly subscriptions: Disposable[];Defined in: packages/sdk/src/types.ts:373
Disposables tracked for this extension; the host disposes them on teardown.
workspaces
readonly workspaces: WorkspaceService;Defined in: packages/sdk/src/types.ts:405
Consumer API for driving workspace state — create, rename, reorder, activate, soft close/reopen, and hard delete. Subscribe to a frozen state for read access without depending on Valtio.
editors
readonly editors: EditorService;Defined in: packages/sdk/src/types.ts:411
The editor & document domain — open files into editor tabs, drive the active editor (save / close), and register editor save handlers. Opening editors lives here, not on ExtensionContext.workspaces.
layout
readonly layout: LayoutService;Defined in: packages/sdk/src/types.ts:417
Consumer API for app layout — side-panel collapse state. Read via getState/useServiceState/subscribe; drive via toggleSidePanel / setSidePanelCollapsed.
process
readonly process: ProcessService;Defined in: packages/sdk/src/types.ts:423
Persistent process / PTY sessions that survive app restarts — the core primitive under the terminal (and future task runners, REPLs). Spawn or re-attach a session and drive it via the returned ProcessSession.
terminals
readonly terminals: TerminalService;Defined in: packages/sdk/src/types.ts:431
Consumer API for the terminal domain — open a terminal tab in a workspace (create) or reap a workspace's terminals (closeWorkspace). The terminal is a core feature (a built-in DockKind like the editor); its tabs render from the workspace's records, and PTY sessions live on ExtensionContext.process.
files
readonly files: FileService;Defined in: packages/sdk/src/types.ts:437
Host-mediated filesystem access — read / write / list / watch, all routed through the host rather than raw Tauri. The single privileged chokepoint for the filesystem; watcher lifecycle is host-owned (see FileService).
search
readonly search: SearchService;Defined in: packages/sdk/src/types.ts:444
Cross-file content search over the workspace — the core primitive under the Search panel (and future quick-open / find-references). Runs a native search engine in the host (off the UI thread), honoring .gitignore, and resolves with matches grouped by file. See SearchService.
theme
readonly theme: ThemeService;Defined in: packages/sdk/src/types.ts:451
Consumer API for the theme domain — read the merged preset set + active theme, switch themes, and manage custom themes. Read via getState / subscribe; contribute a new preset via ExtensionContext.registerThemePreset.
dnd
readonly dnd: DndService;Defined in: packages/sdk/src/types.ts:458
Drag-and-drop — be a drag source (DndService.beginDrag) and a drop target (DndService.registerDropTarget), with typed payloads (DND_MIME) that interoperate across extensions. The host owns the drag affordance and the modifier-mode resolution.
ui
readonly ui: UiService;Defined in: packages/sdk/src/types.ts:465
User-interaction — the only sanctioned way to talk to the user (the host renders the chrome). Native file/folder pickers (UiService.pickFolder, UiService.pickFile, UiService.savePath) and transient toast notifications (UiService.notify). Mirrors VS Code's window.show*.
Methods
registerEditor()
registerEditor(editor): Disposable;Defined in: packages/sdk/src/types.ts:375
Register an Editor (a presenter for a file type's editor tab).
Parameters
editor
Returns
registerFileType()
registerFileType(type): Disposable;Defined in: packages/sdk/src/types.ts:377
Register a FileType (declarative file metadata).
Parameters
type
Returns
registerCommand()
registerCommand(cmd): Disposable;Defined in: packages/sdk/src/types.ts:379
Register a Command (a named, invokable action).
Parameters
cmd
Returns
registerMenuItem()
registerMenuItem(item): Disposable;Defined in: packages/sdk/src/types.ts:381
Register a MenuItemContribution (place a command in a menu).
Parameters
item
Returns
registerKeybinding()
registerKeybinding(binding): Disposable;Defined in: packages/sdk/src/types.ts:383
Register a Keybinding (bind a shortcut to a command).
Parameters
binding
Returns
registerSidePanel()
registerSidePanel(panel): Disposable;Defined in: packages/sdk/src/types.ts:385
Register a SidePanel (a left/right column panel).
Parameters
panel
Returns
registerDockPanelKind()
registerDockPanelKind(kind): Disposable;Defined in: packages/sdk/src/types.ts:387
Register a DockPanelKind (a center-dock tab kind).
Parameters
kind
Returns
registerStatusItem()
registerStatusItem(item): Disposable;Defined in: packages/sdk/src/types.ts:389
Register a StatusItem (a status-bar widget).
Parameters
item
Returns
registerSettingsPage()
registerSettingsPage(page): Disposable;Defined in: packages/sdk/src/types.ts:391
Register a SettingsPage (a page in the Settings dialog).
Parameters
page
Returns
registerThemePreset()
registerThemePreset(preset): Disposable;Defined in: packages/sdk/src/types.ts:393
Register a ThemePreset (a selectable theme in the picker).
Parameters
preset
Returns
executeCommand()
executeCommand(id): void;Defined in: packages/sdk/src/types.ts:399
Invoke a registered command by id — including commands contributed by other extensions. The minimal "operate" primitive; pairs with the typed services for read access.
Parameters
id
string
Returns
void
getExtension()
getExtension<API>(id): ExtensionHandle<API> | undefined;Defined in: packages/sdk/src/types.ts:479
Resolve a handle to another extension in order to consume the API it published (the value its Extension.activate returned). This is how features that live outside core — git, terminal, themes — expose capabilities to other extensions.
Returns undefined if no extension with that id is known. Even when known, the handle's api is undefined until that extension has activated — so always handle absence; the provider may be disabled or activate after you. Call this at use time, not in activate.
Type Parameters
API
API = unknown
the provider's published API type (import its types package).
Parameters
id
string
Returns
ExtensionHandle<API> | undefined