MCPcopy
hub / github.com/microsoft/vscode / EditorHandlerCommand

Class EditorHandlerCommand

src/vs/editor/browser/coreCommands.ts:2130–2151  ·  view source on GitHub ↗

* A command that will invoke a command on the focused editor.

Source from the content-addressed store, hash-verified

2128 * A command that will invoke a command on the focused editor.
2129 */
2130class EditorHandlerCommand extends Command {
2131
2132 private readonly _handlerId: string;
2133
2134 constructor(id: string, handlerId: string, metadata?: ICommandMetadata) {
2135 super({
2136 id: id,
2137 precondition: undefined,
2138 metadata
2139 });
2140 this._handlerId = handlerId;
2141 }
2142
2143 public runCommand(accessor: ServicesAccessor, args: unknown): void {
2144 const editor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
2145 if (!editor) {
2146 return;
2147 }
2148
2149 editor.trigger('keyboard', this._handlerId, args);
2150 }
2151}
2152
2153function registerOverwritableCommand(handlerId: string, metadata?: ICommandMetadata): void {
2154 registerCommand(new EditorHandlerCommand('default:' + handlerId, handlerId));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…