Skip to main content

CommandContext

type

The context a `command(...)` handler receives. `command` is what it adds: the id that ran and the arguments it was given, which is how one handler can serve a palette entry, a keybinding, and a programmatic call. It has `ui` for talking to the user and `auth` for tokens, but no `editor`. Reach the document through `ctx.state('editor.selection')` and change it through `ctx.action(...)`.

type CommandContext = ContextBase & { /** What was run, and with what arguments. */ readonly command: CommandInvocation; /** Notifications, dialogs, quick input, and progress. */ readonly ui: UiCapability; /** Sign in and read sessions from auth providers. */ readonly auth: AuthViewApi; }

Import

import { CommandContext } from '@modular/sdk';