api.commands
CommandsApi
Named things a plugin can do, so a menu item, a hotkey, a context entry and another
plugin all reach the same one. menu.add, contextMenu.add and hotkeys.add take a
command id in place of a run.
Members
register
register(spec: CommandSpec): Disposable;
run
run(id: string, ...args: unknown[]): unknown;
Run one, whoever registered it; the command's own return value, or undefined when there is no such command.
has
has(id: string): boolean;
Types
Declarations only this group names.
CommandSpecinterface
interface CommandSpec
id: string | The command's id. One without a dot is namespaced under the plugin
( |
|---|---|
title: string | What a menu or a command list should call it. |
enabled?: () => boolean | |
run: (...args: unknown[]) => unknown |
CommandInfointerface
interface CommandInfo
id: string | |
|---|---|
title: string | |
pluginId: string | |
enabled: boolean |