Skip to content

Commit d5fd39f

Browse files
Convert cleanDatabases to not use commands
1 parent cd03002 commit d5fd39f

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

extensions/ql-vscode/src/local-databases.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,15 @@ export class DatabaseManager extends DisposableObject {
10011001
});
10021002
}
10031003

1004+
public async removeAllDatabases(
1005+
progress: ProgressCallback,
1006+
token: vscode.CancellationToken,
1007+
) {
1008+
for (const item of this.databaseItems) {
1009+
await this.removeDatabaseItem(progress, token, item);
1010+
}
1011+
}
1012+
10041013
private async deregisterDatabase(
10051014
progress: ProgressCallback,
10061015
token: vscode.CancellationToken,

extensions/ql-vscode/test/vscode-tests/global.helper.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { join } from "path";
22
import { load, dump } from "js-yaml";
33
import { realpathSync, readFileSync, writeFileSync } from "fs-extra";
4-
import { commands, extensions } from "vscode";
4+
import { CancellationToken, extensions } from "vscode";
55
import { DatabaseManager } from "../../src/local-databases";
66
import { CodeQLCliServer } from "../../src/cli";
77
import { removeWorkspaceRefs } from "../../src/variant-analysis/run-remote-query";
88
import { CodeQLExtensionInterface } from "../../src/extension";
9+
import { ProgressCallback } from "../../src/progress";
910

1011
// This file contains helpers shared between tests that work with an activated extension.
1112

@@ -37,9 +38,10 @@ export async function getActivatedExtension(): Promise<CodeQLExtensionInterface>
3738
}
3839

3940
export async function cleanDatabases(databaseManager: DatabaseManager) {
40-
for (const item of databaseManager.databaseItems) {
41-
await commands.executeCommand("codeQLDatabases.removeDatabase", item);
42-
}
41+
await databaseManager.removeAllDatabases(
42+
{} as ProgressCallback,
43+
{} as CancellationToken,
44+
);
4345
}
4446

4547
/**

0 commit comments

Comments
 (0)