calling executeCommand for a locally known extension cmd should fire activation event (#153683)

We should always fire the event but when the command is already known (locally) we don't await that.

fixes https://github.com/microsoft/vscode/issues/150293
This commit is contained in:
Johannes Rieken
2022-06-29 16:37:23 +02:00
committed by GitHub
parent 8045df1b94
commit 7fb4287727
4 changed files with 39 additions and 2 deletions

View File

@@ -90,4 +90,28 @@ suite('ExtHostCommands', function () {
assert.strictEqual(result, 17);
assert.strictEqual(count, 2);
});
test('onCommand:abc activates extensions when executed from command palette, but not when executed programmatically with vscode.commands.executeCommand #150293', async function () {
const activationEvents: string[] = [];
const shape = new class extends mock<MainThreadCommandsShape>() {
override $registerCommand(id: string): void {
//
}
override $fireCommandActivationEvent(id: string): void {
activationEvents.push(id);
}
};
const commands = new ExtHostCommands(
SingleProxyRPCProtocol(shape),
new NullLogService()
);
commands.registerCommand(true, 'extCmd', (args: any): any => args);
const result = await commands.executeCommand('extCmd', this);
assert.strictEqual(result, this);
assert.deepStrictEqual(activationEvents, ['extCmd']);
});
});