Skip to content

Commit 94db1df

Browse files
Remove codeQL.openVariantAnalysisQueryText command
1 parent a375afd commit 94db1df

File tree

6 files changed

+12
-21
lines changed

6 files changed

+12
-21
lines changed

extensions/ql-vscode/src/extension.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,15 +1198,6 @@ async function activateWithInstalledDistribution(
11981198
),
11991199
);
12001200

1201-
ctx.subscriptions.push(
1202-
commandRunner(
1203-
"codeQL.openVariantAnalysisQueryText",
1204-
async (variantAnalysisId: number) => {
1205-
await variantAnalysisManager.openQueryText(variantAnalysisId);
1206-
},
1207-
),
1208-
);
1209-
12101201
ctx.subscriptions.push(
12111202
commandRunner("codeQL.openReferencedFile", async (selectedQuery: Uri) => {
12121203
await openReferencedFile(qs, cliServer, selectedQuery);

extensions/ql-vscode/src/query-history/query-history-manager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,8 +1034,7 @@ export class QueryHistoryManager extends DisposableObject {
10341034
}
10351035

10361036
if (finalSingleItem.t === "variant-analysis") {
1037-
await commands.executeCommand(
1038-
"codeQL.openVariantAnalysisQueryText",
1037+
await this.variantAnalysisManager.openQueryText(
10391038
finalSingleItem.variantAnalysis.id,
10401039
);
10411040
return;

extensions/ql-vscode/src/variant-analysis/variant-analysis-view-manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ export interface VariantAnalysisViewManager<
2525
variantAnalysisId: number,
2626
): Promise<VariantAnalysisScannedRepositoryState[]>;
2727
openQueryFile(variantAnalysisId: number): Promise<void>;
28+
openQueryText(variantAnalysisId: number): Promise<void>;
2829
cancelVariantAnalysis(variantAnalysisId: number): Promise<void>;
2930
}

extensions/ql-vscode/src/variant-analysis/variant-analysis-view.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,7 @@ export class VariantAnalysisView
123123
await this.manager.openQueryFile(this.variantAnalysisId);
124124
break;
125125
case "openQueryText":
126-
void commands.executeCommand(
127-
"codeQL.openVariantAnalysisQueryText",
128-
this.variantAnalysisId,
129-
);
126+
await this.manager.openQueryText(this.variantAnalysisId);
130127
break;
131128
case "copyRepositoryList":
132129
void commands.executeCommand(

extensions/ql-vscode/src/view/variant-analysis/VariantAnalysis.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const openQueryText = () => {
3232
vscode.postMessage({
3333
t: "openQueryText",
3434
});
35+
sendTelemetry("variant-analysis-open-query-text");
3536
};
3637

3738
const stopQuery = () => {

extensions/ql-vscode/test/vscode-tests/no-workspace/query-history/variant-analysis-history.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "fs-extra";
99
import { join } from "path";
1010

11-
import { commands, ExtensionContext, Uri } from "vscode";
11+
import { ExtensionContext, Uri } from "vscode";
1212
import { DatabaseManager } from "../../../../src/local-databases";
1313
import { tmpDir, walkDirectory } from "../../../../src/helpers";
1414
import { DisposableBucket } from "../../disposable-bucket";
@@ -54,9 +54,12 @@ describe("Variant Analyses and QueryHistoryManager", () => {
5454
rehydrateVariantAnalysis: rehydrateVariantAnalysisStub,
5555
onVariantAnalysisStatusUpdated: jest.fn(),
5656
showView: showViewStub,
57+
openQueryText: jest.fn(),
5758
} as any as VariantAnalysisManager;
5859

59-
let executeCommandSpy: jest.SpiedFunction<typeof commands.executeCommand>;
60+
let openQueryTextSpy: jest.SpiedFunction<
61+
typeof variantAnalysisManagerStub.openQueryText
62+
>;
6063

6164
beforeEach(async () => {
6265
// Since these tests change the state of the query history manager, we need to copy the original
@@ -95,8 +98,8 @@ describe("Variant Analyses and QueryHistoryManager", () => {
9598
);
9699
disposables.push(qhm);
97100

98-
executeCommandSpy = jest
99-
.spyOn(commands, "executeCommand")
101+
openQueryTextSpy = jest
102+
.spyOn(variantAnalysisManagerStub, "openQueryText")
100103
.mockResolvedValue(undefined);
101104
});
102105

@@ -180,8 +183,7 @@ describe("Variant Analyses and QueryHistoryManager", () => {
180183
await qhm.readQueryHistory();
181184
await qhm.handleShowQueryText(qhm.treeDataProvider.allHistory[0], []);
182185

183-
expect(executeCommandSpy).toHaveBeenCalledWith(
184-
"codeQL.openVariantAnalysisQueryText",
186+
expect(openQueryTextSpy).toHaveBeenCalledWith(
185187
rawQueryHistory[0].variantAnalysis.id,
186188
);
187189
});

0 commit comments

Comments
 (0)