Merge pull request #3239 from github/robertbrignull/multi-query-commands

Add stubs of commands for multi-query support
This commit is contained in:
Robert 2024-01-16 10:24:29 +00:00 коммит произвёл GitHub
Родитель 545902843d 1a7981a22d
Коммит a1572463a6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 40 добавлений и 1 удалений

Просмотреть файл

@ -545,6 +545,14 @@
"command": "codeQL.runVariantAnalysisContextEditor",
"title": "CodeQL: Run Variant Analysis"
},
{
"command": "codeQL.runVariantAnalysisContextExplorer",
"title": "CodeQL: Run Variant Analysis"
},
{
"command": "codeQL.runVariantAnalysisPublishedPack",
"title": "CodeQL: Run Variant Analysis against published pack"
},
{
"command": "codeQL.exportSelectedVariantAnalysisResults",
"title": "CodeQL: Export Variant Analysis Results"
@ -1321,6 +1329,11 @@
"group": "9_qlCommands",
"when": "resourceScheme != codeql-zip-archive"
},
{
"command": "codeQL.runVariantAnalysisContextExplorer",
"group": "9_qlCommands",
"when": "resourceExtname == .ql && config.codeQL.canary && config.codeQL.variantAnalysis.multiQuery"
},
{
"command": "codeQL.openReferencedFileContextExplorer",
"group": "9_qlCommands",
@ -1397,6 +1410,14 @@
"command": "codeQL.runVariantAnalysis",
"when": "editorLangId == ql && resourceExtname == .ql"
},
{
"command": "codeQL.runVariantAnalysisContextExplorer",
"when": "false"
},
{
"command": "codeQL.runVariantAnalysisPublishedPack",
"when": "config.codeQL.canary && config.codeQL.variantAnalysis.multiQuery"
},
{
"command": "codeQL.runVariantAnalysisContextEditor",
"when": "false"

Просмотреть файл

@ -277,7 +277,9 @@ export type VariantAnalysisCommands = {
) => Promise<void>;
"codeQL.runVariantAnalysis": (uri?: Uri) => Promise<void>;
"codeQL.runVariantAnalysisContextEditor": (uri?: Uri) => Promise<void>;
"codeQL.runVariantAnalysisContextExplorer": ExplorerSelectionCommandFunction<Uri>;
"codeQLQueries.runVariantAnalysisContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
"codeQL.runVariantAnalysisPublishedPack": () => Promise<void>;
};
export type DatabasePanelCommands = {

Просмотреть файл

@ -86,6 +86,7 @@ import {
import type { QueryTreeViewItem } from "../queries-panel/query-tree-view-item";
import { RequestError } from "@octokit/request-error";
import { handleRequestError } from "./custom-errors";
import { createMultiSelectionCommand } from "../common/vscode/selection-commands";
const maxRetryCount = 3;
@ -167,11 +168,15 @@ export class VariantAnalysisManager
"codeQL.openVariantAnalysisView": this.showView.bind(this),
"codeQL.runVariantAnalysis":
this.runVariantAnalysisFromCommand.bind(this),
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.runVariantAnalysis" command
"codeQL.runVariantAnalysisContextEditor":
this.runVariantAnalysisFromCommand.bind(this),
"codeQL.runVariantAnalysisContextExplorer": createMultiSelectionCommand(
this.runVariantAnalysisFromExplorer.bind(this),
),
"codeQLQueries.runVariantAnalysisContextMenu":
this.runVariantAnalysisFromQueriesPanel.bind(this),
"codeQL.runVariantAnalysisPublishedPack":
this.runVariantAnalysisFromPublishedPack.bind(this),
};
}
@ -194,6 +199,13 @@ export class VariantAnalysisManager
);
}
private async runVariantAnalysisFromExplorer(fileURIs: Uri[]): Promise<void> {
if (fileURIs.length !== 1) {
throw new Error("Can only run a single query at a time");
}
return this.runVariantAnalysisFromCommand(fileURIs[0]);
}
private async runVariantAnalysisFromQueriesPanel(
queryTreeViewItem: QueryTreeViewItem,
): Promise<void> {
@ -204,6 +216,10 @@ export class VariantAnalysisManager
}
}
private async runVariantAnalysisFromPublishedPack(): Promise<void> {
throw new Error("Command not yet implemented");
}
public async runVariantAnalysis(
uri: Uri | undefined,
progress: ProgressCallback,