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` and no `widgets`. Reach the document through `ctx.state('editor.selection')` and change it through `ctx.action(...)`.

type CommandContext = ContextBase & { auth: AuthViewApi; command: CommandInvocation; ui: UiCapability }

Import

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

Notes

category
Context