From 4c43954e84d9e063eeec64d813d54ec279eabe9a Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 7 Feb 2018 11:49:22 +0100 Subject: [PATCH] Fixes #34913: Wait for `*` activation when the command is not registered --- src/vs/platform/commands/common/commandService.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/commands/common/commandService.ts b/src/vs/platform/commands/common/commandService.ts index ac972ac99aa22..db0aff02f20c9 100644 --- a/src/vs/platform/commands/common/commandService.ts +++ b/src/vs/platform/commands/common/commandService.ts @@ -38,11 +38,16 @@ export class CommandService extends Disposable implements ICommandService { // host didn't yet start and the command is already registered const activation = this._extensionService.activateByEvent(`onCommand:${id}`); + const commandIsRegistered = !!CommandsRegistry.getCommand(id); - if (!this._extensionHostIsReady && CommandsRegistry.getCommand(id)) { + if (!this._extensionHostIsReady && commandIsRegistered) { return this._tryExecuteCommand(id, args); } else { - return activation.then(_ => this._tryExecuteCommand(id, args)); + let waitFor: TPromise = activation; + if (!commandIsRegistered) { + waitFor = TPromise.join([activation, this._extensionService.activateByEvent(`*`)]); + } + return waitFor.then(_ => this._tryExecuteCommand(id, args)); } }