Handles a command with no dependencies.
Handles a command with declared dependencies.
Handles a command that needs an editor.
Registered with registerTextEditorCommand, so VS Code only invokes it
with an editor focused and skips it otherwise, rather than calling a
handler that has to give up. Prefer it for anything that edits or reads
the current document.
The trade is real, and it is VS Code's, not the framework's: the registered
callback has a void contract and runs inside the platform's edit
transaction. The framework can start an asynchronous Operation there, but
its result or rejection does not become the result of commands.execute.
Operation failures are still logged by the framework. Declare a command
with CommandCollection.handle instead when a caller must await the
result, and take the editor from Editors.active.
It also does not grey the palette entry out; that is the enablement /
commandPalette when clause in package.json.
The editor is the same ActiveEditor the Editors service hands
out, so a feature written against one works with either declaration.
The dependency-declaring overload is listed first: overload resolution takes the first match, and the no-dependency shape would otherwise absorb the call.
Handles a text editor command with no dependencies.
Records command handlers for the Module.
Each invocation runs as an Operation. Dependencies are resolved for that Operation, disposable transients are owned by its ResourceScope, and a plain command handler's value or rejection is preserved for its caller. The text editor-specific registration below documents its narrower platform contract.