* A command that will invoke a command on the focused editor.
| 2128 | * A command that will invoke a command on the focused editor. |
| 2129 | */ |
| 2130 | class 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 | |
| 2153 | function registerOverwritableCommand(handlerId: string, metadata?: ICommandMetadata): void { |
| 2154 | registerCommand(new EditorHandlerCommand('default:' + handlerId, handlerId)); |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…