Merge pull request #2185 from github/robertbrignull/remove_internal_commands
Remove two more internal-only commands
This commit is contained in:
@@ -1146,15 +1146,6 @@ async function activateWithInstalledDistribution(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
ctx.subscriptions.push(
|
|
||||||
commandRunner(
|
|
||||||
"codeQL.cancelVariantAnalysis",
|
|
||||||
async (variantAnalysisId: number) => {
|
|
||||||
await variantAnalysisManager.cancelVariantAnalysis(variantAnalysisId);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
ctx.subscriptions.push(
|
ctx.subscriptions.push(
|
||||||
commandRunner("codeQL.exportSelectedVariantAnalysisResults", async () => {
|
commandRunner("codeQL.exportSelectedVariantAnalysisResults", async () => {
|
||||||
await exportSelectedVariantAnalysisResults(qhm);
|
await exportSelectedVariantAnalysisResults(qhm);
|
||||||
@@ -1208,15 +1199,6 @@ async function activateWithInstalledDistribution(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
ctx.subscriptions.push(
|
|
||||||
commandRunner(
|
|
||||||
"codeQL.openVariantAnalysisQueryText",
|
|
||||||
async (variantAnalysisId: number) => {
|
|
||||||
await variantAnalysisManager.openQueryText(variantAnalysisId);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
ctx.subscriptions.push(
|
ctx.subscriptions.push(
|
||||||
commandRunner("codeQL.openReferencedFile", async (selectedQuery: Uri) => {
|
commandRunner("codeQL.openReferencedFile", async (selectedQuery: Uri) => {
|
||||||
await openReferencedFile(qs, cliServer, selectedQuery);
|
await openReferencedFile(qs, cliServer, selectedQuery);
|
||||||
|
|||||||
@@ -894,8 +894,7 @@ export class QueryHistoryManager extends DisposableObject {
|
|||||||
if (item.t === "local") {
|
if (item.t === "local") {
|
||||||
item.cancel();
|
item.cancel();
|
||||||
} else if (item.t === "variant-analysis") {
|
} else if (item.t === "variant-analysis") {
|
||||||
await commands.executeCommand(
|
await this.variantAnalysisManager.cancelVariantAnalysis(
|
||||||
"codeQL.cancelVariantAnalysis",
|
|
||||||
item.variantAnalysis.id,
|
item.variantAnalysis.id,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -921,8 +920,7 @@ export class QueryHistoryManager extends DisposableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (finalSingleItem.t === "variant-analysis") {
|
if (finalSingleItem.t === "variant-analysis") {
|
||||||
await commands.executeCommand(
|
await this.variantAnalysisManager.openQueryText(
|
||||||
"codeQL.openVariantAnalysisQueryText",
|
|
||||||
finalSingleItem.variantAnalysis.id,
|
finalSingleItem.variantAnalysis.id,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -25,4 +25,6 @@ export interface VariantAnalysisViewManager<
|
|||||||
variantAnalysisId: number,
|
variantAnalysisId: number,
|
||||||
): Promise<VariantAnalysisScannedRepositoryState[]>;
|
): Promise<VariantAnalysisScannedRepositoryState[]>;
|
||||||
openQueryFile(variantAnalysisId: number): Promise<void>;
|
openQueryFile(variantAnalysisId: number): Promise<void>;
|
||||||
|
openQueryText(variantAnalysisId: number): Promise<void>;
|
||||||
|
cancelVariantAnalysis(variantAnalysisId: number): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,10 +115,7 @@ export class VariantAnalysisView
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case "cancelVariantAnalysis":
|
case "cancelVariantAnalysis":
|
||||||
void commands.executeCommand(
|
await this.manager.cancelVariantAnalysis(this.variantAnalysisId);
|
||||||
"codeQL.cancelVariantAnalysis",
|
|
||||||
this.variantAnalysisId,
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "requestRepositoryResults":
|
case "requestRepositoryResults":
|
||||||
void commands.executeCommand(
|
void commands.executeCommand(
|
||||||
@@ -131,10 +128,7 @@ export class VariantAnalysisView
|
|||||||
await this.manager.openQueryFile(this.variantAnalysisId);
|
await this.manager.openQueryFile(this.variantAnalysisId);
|
||||||
break;
|
break;
|
||||||
case "openQueryText":
|
case "openQueryText":
|
||||||
void commands.executeCommand(
|
await this.manager.openQueryText(this.variantAnalysisId);
|
||||||
"codeQL.openVariantAnalysisQueryText",
|
|
||||||
this.variantAnalysisId,
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "copyRepositoryList":
|
case "copyRepositoryList":
|
||||||
void commands.executeCommand(
|
void commands.executeCommand(
|
||||||
|
|||||||
@@ -32,12 +32,14 @@ const openQueryText = () => {
|
|||||||
vscode.postMessage({
|
vscode.postMessage({
|
||||||
t: "openQueryText",
|
t: "openQueryText",
|
||||||
});
|
});
|
||||||
|
sendTelemetry("variant-analysis-open-query-text");
|
||||||
};
|
};
|
||||||
|
|
||||||
const stopQuery = () => {
|
const stopQuery = () => {
|
||||||
vscode.postMessage({
|
vscode.postMessage({
|
||||||
t: "cancelVariantAnalysis",
|
t: "cancelVariantAnalysis",
|
||||||
});
|
});
|
||||||
|
sendTelemetry("variant-analysis-cancel");
|
||||||
};
|
};
|
||||||
|
|
||||||
const openLogs = () => {
|
const openLogs = () => {
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ describe("QueryHistoryManager", () => {
|
|||||||
let executeCommandSpy: jest.SpiedFunction<
|
let executeCommandSpy: jest.SpiedFunction<
|
||||||
typeof vscode.commands.executeCommand
|
typeof vscode.commands.executeCommand
|
||||||
>;
|
>;
|
||||||
|
let cancelVariantAnalysisSpy: jest.SpiedFunction<
|
||||||
|
typeof variantAnalysisManagerStub.cancelVariantAnalysis
|
||||||
|
>;
|
||||||
const doCompareCallback = jest.fn();
|
const doCompareCallback = jest.fn();
|
||||||
|
|
||||||
let queryHistoryManager: QueryHistoryManager;
|
let queryHistoryManager: QueryHistoryManager;
|
||||||
@@ -82,9 +85,14 @@ describe("QueryHistoryManager", () => {
|
|||||||
onVariantAnalysisStatusUpdated: jest.fn(),
|
onVariantAnalysisStatusUpdated: jest.fn(),
|
||||||
onVariantAnalysisRemoved: jest.fn(),
|
onVariantAnalysisRemoved: jest.fn(),
|
||||||
removeVariantAnalysis: jest.fn(),
|
removeVariantAnalysis: jest.fn(),
|
||||||
|
cancelVariantAnalysis: jest.fn(),
|
||||||
showView: jest.fn(),
|
showView: jest.fn(),
|
||||||
} as any as VariantAnalysisManager;
|
} as any as VariantAnalysisManager;
|
||||||
|
|
||||||
|
cancelVariantAnalysisSpy = jest
|
||||||
|
.spyOn(variantAnalysisManagerStub, "cancelVariantAnalysis")
|
||||||
|
.mockResolvedValue(undefined);
|
||||||
|
|
||||||
localQueryHistory = [
|
localQueryHistory = [
|
||||||
// completed
|
// completed
|
||||||
createMockLocalQueryInfo({
|
createMockLocalQueryInfo({
|
||||||
@@ -729,8 +737,7 @@ describe("QueryHistoryManager", () => {
|
|||||||
const inProgress1 = variantAnalysisHistory[1];
|
const inProgress1 = variantAnalysisHistory[1];
|
||||||
|
|
||||||
await queryHistoryManager.handleCancel(inProgress1, [inProgress1]);
|
await queryHistoryManager.handleCancel(inProgress1, [inProgress1]);
|
||||||
expect(executeCommandSpy).toBeCalledWith(
|
expect(cancelVariantAnalysisSpy).toBeCalledWith(
|
||||||
"codeQL.cancelVariantAnalysis",
|
|
||||||
inProgress1.variantAnalysis.id,
|
inProgress1.variantAnalysis.id,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -746,12 +753,10 @@ describe("QueryHistoryManager", () => {
|
|||||||
inProgress1,
|
inProgress1,
|
||||||
inProgress2,
|
inProgress2,
|
||||||
]);
|
]);
|
||||||
expect(executeCommandSpy).toBeCalledWith(
|
expect(cancelVariantAnalysisSpy).toBeCalledWith(
|
||||||
"codeQL.cancelVariantAnalysis",
|
|
||||||
inProgress1.variantAnalysis.id,
|
inProgress1.variantAnalysis.id,
|
||||||
);
|
);
|
||||||
expect(executeCommandSpy).toBeCalledWith(
|
expect(cancelVariantAnalysisSpy).toBeCalledWith(
|
||||||
"codeQL.cancelVariantAnalysis",
|
|
||||||
inProgress2.variantAnalysis.id,
|
inProgress2.variantAnalysis.id,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -793,8 +798,7 @@ describe("QueryHistoryManager", () => {
|
|||||||
await queryHistoryManager.handleCancel(completedVariantAnalysis, [
|
await queryHistoryManager.handleCancel(completedVariantAnalysis, [
|
||||||
completedVariantAnalysis,
|
completedVariantAnalysis,
|
||||||
]);
|
]);
|
||||||
expect(executeCommandSpy).not.toBeCalledWith(
|
expect(cancelVariantAnalysisSpy).not.toBeCalledWith(
|
||||||
"codeQL.cancelVariantAnalysis",
|
|
||||||
completedVariantAnalysis.variantAnalysis,
|
completedVariantAnalysis.variantAnalysis,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -810,12 +814,10 @@ describe("QueryHistoryManager", () => {
|
|||||||
completedVariantAnalysis,
|
completedVariantAnalysis,
|
||||||
failedVariantAnalysis,
|
failedVariantAnalysis,
|
||||||
]);
|
]);
|
||||||
expect(executeCommandSpy).not.toBeCalledWith(
|
expect(cancelVariantAnalysisSpy).not.toBeCalledWith(
|
||||||
"codeQL.cancelVariantAnalysis",
|
|
||||||
completedVariantAnalysis.variantAnalysis.id,
|
completedVariantAnalysis.variantAnalysis.id,
|
||||||
);
|
);
|
||||||
expect(executeCommandSpy).not.toBeCalledWith(
|
expect(cancelVariantAnalysisSpy).not.toBeCalledWith(
|
||||||
"codeQL.cancelVariantAnalysis",
|
|
||||||
failedVariantAnalysis.variantAnalysis.id,
|
failedVariantAnalysis.variantAnalysis.id,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
} from "fs-extra";
|
} from "fs-extra";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
import { commands, ExtensionContext, Uri } from "vscode";
|
import { ExtensionContext, Uri } from "vscode";
|
||||||
import { DatabaseManager } from "../../../../src/local-databases";
|
import { DatabaseManager } from "../../../../src/local-databases";
|
||||||
import { tmpDir, walkDirectory } from "../../../../src/helpers";
|
import { tmpDir, walkDirectory } from "../../../../src/helpers";
|
||||||
import { DisposableBucket } from "../../disposable-bucket";
|
import { DisposableBucket } from "../../disposable-bucket";
|
||||||
@@ -54,9 +54,12 @@ describe("Variant Analyses and QueryHistoryManager", () => {
|
|||||||
rehydrateVariantAnalysis: rehydrateVariantAnalysisStub,
|
rehydrateVariantAnalysis: rehydrateVariantAnalysisStub,
|
||||||
onVariantAnalysisStatusUpdated: jest.fn(),
|
onVariantAnalysisStatusUpdated: jest.fn(),
|
||||||
showView: showViewStub,
|
showView: showViewStub,
|
||||||
|
openQueryText: jest.fn(),
|
||||||
} as any as VariantAnalysisManager;
|
} as any as VariantAnalysisManager;
|
||||||
|
|
||||||
let executeCommandSpy: jest.SpiedFunction<typeof commands.executeCommand>;
|
let openQueryTextSpy: jest.SpiedFunction<
|
||||||
|
typeof variantAnalysisManagerStub.openQueryText
|
||||||
|
>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
// Since these tests change the state of the query history manager, we need to copy the original
|
// 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", () => {
|
|||||||
);
|
);
|
||||||
disposables.push(qhm);
|
disposables.push(qhm);
|
||||||
|
|
||||||
executeCommandSpy = jest
|
openQueryTextSpy = jest
|
||||||
.spyOn(commands, "executeCommand")
|
.spyOn(variantAnalysisManagerStub, "openQueryText")
|
||||||
.mockResolvedValue(undefined);
|
.mockResolvedValue(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -180,8 +183,7 @@ describe("Variant Analyses and QueryHistoryManager", () => {
|
|||||||
await qhm.readQueryHistory();
|
await qhm.readQueryHistory();
|
||||||
await qhm.handleShowQueryText(qhm.treeDataProvider.allHistory[0], []);
|
await qhm.handleShowQueryText(qhm.treeDataProvider.allHistory[0], []);
|
||||||
|
|
||||||
expect(executeCommandSpy).toHaveBeenCalledWith(
|
expect(openQueryTextSpy).toHaveBeenCalledWith(
|
||||||
"codeQL.openVariantAnalysisQueryText",
|
|
||||||
rawQueryHistory[0].variantAnalysis.id,
|
rawQueryHistory[0].variantAnalysis.id,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user