Remove codeQL.copyRepoList command
This commit is contained in:
@@ -1128,12 +1128,6 @@ async function activateWithInstalledDistribution(
|
||||
),
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunner("codeQL.copyRepoList", async (queryId: string) => {
|
||||
await rqm.copyRemoteQueryRepoListToClipboard(queryId);
|
||||
}),
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunner(
|
||||
"codeQL.openVariantAnalysisLogs",
|
||||
|
||||
@@ -1289,12 +1289,7 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
return;
|
||||
}
|
||||
|
||||
if (finalSingleItem.t === "remote") {
|
||||
await commands.executeCommand(
|
||||
"codeQL.copyRepoList",
|
||||
finalSingleItem.queryId,
|
||||
);
|
||||
} else if (finalSingleItem.t === "variant-analysis") {
|
||||
if (finalSingleItem.t === "variant-analysis") {
|
||||
await commands.executeCommand(
|
||||
"codeQL.copyVariantAnalysisRepoList",
|
||||
finalSingleItem.variantAnalysis.id,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { CancellationToken, env, EventEmitter, ExtensionContext } from "vscode";
|
||||
import { CancellationToken, EventEmitter, ExtensionContext } from "vscode";
|
||||
import { join } from "path";
|
||||
import { pathExists, readFile, remove } from "fs-extra";
|
||||
import { EOL } from "os";
|
||||
|
||||
import { CodeQLCliServer } from "../cli";
|
||||
import { showAndLogExceptionWithTelemetry } from "../helpers";
|
||||
@@ -152,37 +151,10 @@ export class RemoteQueriesManager extends DisposableObject {
|
||||
);
|
||||
}
|
||||
|
||||
public async copyRemoteQueryRepoListToClipboard(queryId: string) {
|
||||
const queryResult = await this.getRemoteQueryResult(queryId);
|
||||
const repos = queryResult.analysisSummaries
|
||||
.filter((a) => a.resultCount > 0)
|
||||
.map((a) => a.nwo);
|
||||
|
||||
if (repos.length > 0) {
|
||||
const text = [
|
||||
'"new-repo-list": [',
|
||||
...repos.slice(0, -1).map((repo) => ` "${repo}",`),
|
||||
` "${repos[repos.length - 1]}"`,
|
||||
"]",
|
||||
];
|
||||
|
||||
await env.clipboard.writeText(text.join(EOL));
|
||||
}
|
||||
}
|
||||
|
||||
public async openResults(query: RemoteQuery, queryResult: RemoteQueryResult) {
|
||||
await this.view.showResults(query, queryResult);
|
||||
}
|
||||
|
||||
private async getRemoteQueryResult(
|
||||
queryId: string,
|
||||
): Promise<RemoteQueryResult> {
|
||||
return await this.retrieveJsonFile<RemoteQueryResult>(
|
||||
queryId,
|
||||
"query-result.json",
|
||||
);
|
||||
}
|
||||
|
||||
private async retrieveJsonFile<T>(
|
||||
queryId: string,
|
||||
fileName: string,
|
||||
|
||||
@@ -154,7 +154,6 @@ export class RemoteQueriesView extends AbstractWebview<
|
||||
await this.openVirtualFile(msg.queryText);
|
||||
break;
|
||||
case "copyRepoList":
|
||||
await commands.executeCommand("codeQL.copyRepoList", msg.queryId);
|
||||
break;
|
||||
case "remoteQueryDownloadAnalysisResults":
|
||||
await this.downloadAnalysisResults(msg);
|
||||
|
||||
@@ -1109,26 +1109,6 @@ describe("QueryHistoryManager", () => {
|
||||
expect(executeCommandSpy).not.toBeCalled();
|
||||
});
|
||||
|
||||
it("should copy repo list for a single remote query", async () => {
|
||||
queryHistoryManager = await createMockQueryHistory(allHistory);
|
||||
|
||||
const item = remoteQueryHistory[1];
|
||||
await queryHistoryManager.handleCopyRepoList(item, [item]);
|
||||
expect(executeCommandSpy).toBeCalledWith(
|
||||
"codeQL.copyRepoList",
|
||||
item.queryId,
|
||||
);
|
||||
});
|
||||
|
||||
it("should not copy repo list for multiple remote queries", async () => {
|
||||
queryHistoryManager = await createMockQueryHistory(allHistory);
|
||||
|
||||
const item1 = remoteQueryHistory[1];
|
||||
const item2 = remoteQueryHistory[3];
|
||||
await queryHistoryManager.handleCopyRepoList(item1, [item1, item2]);
|
||||
expect(executeCommandSpy).not.toBeCalled();
|
||||
});
|
||||
|
||||
it("should copy repo list for a single variant analysis", async () => {
|
||||
queryHistoryManager = await createMockQueryHistory(allHistory);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user