| 557 | } |
| 558 | |
| 559 | export function registerCommand( |
| 560 | context: vscode.ExtensionContext, |
| 561 | command: string, |
| 562 | callback: (...args: any[]) => any, |
| 563 | requiresActiveEditor: boolean = true, |
| 564 | ) { |
| 565 | const disposable = vscode.commands.registerCommand(command, async (args) => { |
| 566 | if (requiresActiveEditor && !vscode.window.activeTextEditor) { |
| 567 | return; |
| 568 | } |
| 569 | |
| 570 | callback(args); |
| 571 | }); |
| 572 | context.subscriptions.push(disposable); |
| 573 | } |
| 574 | |
| 575 | export function registerEventListener<T>( |
| 576 | context: vscode.ExtensionContext, |