diff --git a/src/vs/workbench/api/browser/mainThreadCommands.ts b/src/vs/workbench/api/browser/mainThreadCommands.ts index 3f98aed5553..1f63ed47dd0 100644 --- a/src/vs/workbench/api/browser/mainThreadCommands.ts +++ b/src/vs/workbench/api/browser/mainThreadCommands.ts @@ -79,11 +79,11 @@ export class MainThreadCommands implements MainThreadCommandsShape { return this._commandService.executeCommand(id, ...args); } - $onDidExecuteCommand() { + $registerCommandListener() { this._onDidExecuteCommandListener = this._commandService.onDidExecuteCommand((command) => this.handleExecuteCommand(command)); } - $disposeListener() { + $unregisterCommandListener() { return this._onDidExecuteCommandListener.dispose(); } diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 71446f49d62..7dafdda0c68 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -113,8 +113,8 @@ export interface MainThreadClipboardShape extends IDisposable { export interface MainThreadCommandsShape extends IDisposable { $registerCommand(id: string): void; - $onDidExecuteCommand(): void; - $disposeListener(): void; + $registerCommandListener(): void; + $unregisterCommandListener(): void; $unregisterCommand(id: string): void; $executeCommand(id: string, args: any[]): Promise; $getCommands(): Promise; diff --git a/src/vs/workbench/api/common/extHostCommands.ts b/src/vs/workbench/api/common/extHostCommands.ts index bdd6219fda2..2c84c8d03f7 100644 --- a/src/vs/workbench/api/common/extHostCommands.ts +++ b/src/vs/workbench/api/common/extHostCommands.ts @@ -48,8 +48,8 @@ export class ExtHostCommands implements ExtHostCommandsShape { ) { this._proxy = mainContext.getProxy(MainContext.MainThreadCommands); this._onDidExecuteCommand = new Emitter({ - onFirstListenerDidAdd: this._proxy.$onDidExecuteCommand, - onLastListenerRemove: this._proxy.$disposeListener, + onFirstListenerDidAdd: () => this._proxy.$registerCommandListener(), + onLastListenerRemove: () => this._proxy.$unregisterCommandListener(), }); this.onDidExecuteCommandEmitter = this._onDidExecuteCommand.event; this._logService = logService;