Skip to content

Commit 1a0d881

Browse files
authored
Add executeCommand to app container (#1857)
1 parent ed76b46 commit 1a0d881

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

extensions/ql-vscode/src/common/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { AppEventEmitter } from "./events";
33

44
export interface App {
55
createEventEmitter<T>(): AppEventEmitter<T>;
6+
executeCommand(command: string, ...args: any): Thenable<void>;
67
mode: AppMode;
78
subscriptions: Disposable[];
89
extensionPath: string;

extensions/ql-vscode/src/common/vscode/vscode-app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@ export class ExtensionApp implements App {
3939
public createEventEmitter<T>(): AppEventEmitter<T> {
4040
return new VSCodeAppEventEmitter<T>();
4141
}
42+
43+
public executeCommand(command: string, ...args: any): Thenable<void> {
44+
return vscode.commands.executeCommand(command, args);
45+
}
4246
}

extensions/ql-vscode/test/__mocks__/appMock.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ export function createMockApp({
77
workspaceStoragePath = "/mock/workspace/storage/path",
88
globalStoragePath = "/mock/global/storage/path",
99
createEventEmitter = <T>() => new MockAppEventEmitter<T>(),
10+
executeCommand = jest.fn(() => Promise.resolve()),
1011
}: {
1112
extensionPath?: string;
1213
workspaceStoragePath?: string;
1314
globalStoragePath?: string;
1415
createEventEmitter?: <T>() => AppEventEmitter<T>;
16+
executeCommand?: () => Promise<void>;
1517
}): App {
1618
return {
1719
mode: AppMode.Test,
@@ -20,6 +22,7 @@ export function createMockApp({
2022
workspaceStoragePath,
2123
globalStoragePath,
2224
createEventEmitter,
25+
executeCommand,
2326
};
2427
}
2528

0 commit comments

Comments
 (0)