Implemented onDidExecuteCommand api method

This commit is contained in:
Harry Hedger
2019-04-15 06:12:54 -07:00
parent 473af338e1
commit 8755a2aa35
13 changed files with 64 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ICommandService, CommandsRegistry, ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
import { ICommandService, CommandsRegistry, ICommandHandlerDescription, ICommandEvent } from 'vs/platform/commands/common/commands';
import { IDisposable } from 'vs/base/common/lifecycle';
import { ExtHostContext, MainThreadCommandsShape, ExtHostCommandsShape, MainContext, IExtHostContext } from '../common/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
@@ -78,9 +78,17 @@ export class MainThreadCommands implements MainThreadCommandsShape {
return this._commandService.executeCommand<T>(id, ...args);
}
$onDidExecuteCommand() {
return this._commandService.onDidExecuteCommand((command) => this.handleExecuteCommand(command));
}
$getCommands(): Promise<string[]> {
return Promise.resolve(Object.keys(CommandsRegistry.getCommands()));
}
handleExecuteCommand(command: ICommandEvent) {
this._proxy.$handleDidExecuteCommand(command);
}
}
// --- command doc