Runs a command by id, resolving with what it returned and rejecting with what it threw.
Untyped on purpose: an id typed as a bare string is a platform command, whose signature the framework cannot know. For the application's own commands use CommandsService.invoke, which does know. Arguments and results cross the platform command boundary unchanged; this method performs no runtime validation.
Command id
Arguments, passed through untouched
Runs one of the application's own commands, typed by its contract.
The contract carries the argument tuple and the result type, so a changed signature fails to compile at every call site rather than at runtime in whichever one the user hits first.
Invoking commands — the platform's, and the application's own.
Registering is the other direction and belongs to a module (
module.commands.handle); this is only for calling one. Most of what an extension reaches for beyond the framework's models is a built-in command —workbench.action.openSettings,setContext,vscode.open— and routing those through the same capability the framework registers against keeps them out of the fakes' blind spot.Example