Merge pull request #3239 from github/robertbrignull/multi-query-commands
Add stubs of commands for multi-query support
This commit is contained in:
Коммит
a1572463a6
|
@ -545,6 +545,14 @@
|
||||||
"command": "codeQL.runVariantAnalysisContextEditor",
|
"command": "codeQL.runVariantAnalysisContextEditor",
|
||||||
"title": "CodeQL: Run Variant Analysis"
|
"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",
|
"command": "codeQL.exportSelectedVariantAnalysisResults",
|
||||||
"title": "CodeQL: Export Variant Analysis Results"
|
"title": "CodeQL: Export Variant Analysis Results"
|
||||||
|
@ -1321,6 +1329,11 @@
|
||||||
"group": "9_qlCommands",
|
"group": "9_qlCommands",
|
||||||
"when": "resourceScheme != codeql-zip-archive"
|
"when": "resourceScheme != codeql-zip-archive"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "codeQL.runVariantAnalysisContextExplorer",
|
||||||
|
"group": "9_qlCommands",
|
||||||
|
"when": "resourceExtname == .ql && config.codeQL.canary && config.codeQL.variantAnalysis.multiQuery"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "codeQL.openReferencedFileContextExplorer",
|
"command": "codeQL.openReferencedFileContextExplorer",
|
||||||
"group": "9_qlCommands",
|
"group": "9_qlCommands",
|
||||||
|
@ -1397,6 +1410,14 @@
|
||||||
"command": "codeQL.runVariantAnalysis",
|
"command": "codeQL.runVariantAnalysis",
|
||||||
"when": "editorLangId == ql && resourceExtname == .ql"
|
"when": "editorLangId == ql && resourceExtname == .ql"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "codeQL.runVariantAnalysisContextExplorer",
|
||||||
|
"when": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "codeQL.runVariantAnalysisPublishedPack",
|
||||||
|
"when": "config.codeQL.canary && config.codeQL.variantAnalysis.multiQuery"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "codeQL.runVariantAnalysisContextEditor",
|
"command": "codeQL.runVariantAnalysisContextEditor",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
|
|
|
@ -277,7 +277,9 @@ export type VariantAnalysisCommands = {
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
"codeQL.runVariantAnalysis": (uri?: Uri) => Promise<void>;
|
"codeQL.runVariantAnalysis": (uri?: Uri) => Promise<void>;
|
||||||
"codeQL.runVariantAnalysisContextEditor": (uri?: Uri) => Promise<void>;
|
"codeQL.runVariantAnalysisContextEditor": (uri?: Uri) => Promise<void>;
|
||||||
|
"codeQL.runVariantAnalysisContextExplorer": ExplorerSelectionCommandFunction<Uri>;
|
||||||
"codeQLQueries.runVariantAnalysisContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
|
"codeQLQueries.runVariantAnalysisContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
|
||||||
|
"codeQL.runVariantAnalysisPublishedPack": () => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DatabasePanelCommands = {
|
export type DatabasePanelCommands = {
|
||||||
|
|
|
@ -86,6 +86,7 @@ import {
|
||||||
import type { QueryTreeViewItem } from "../queries-panel/query-tree-view-item";
|
import type { QueryTreeViewItem } from "../queries-panel/query-tree-view-item";
|
||||||
import { RequestError } from "@octokit/request-error";
|
import { RequestError } from "@octokit/request-error";
|
||||||
import { handleRequestError } from "./custom-errors";
|
import { handleRequestError } from "./custom-errors";
|
||||||
|
import { createMultiSelectionCommand } from "../common/vscode/selection-commands";
|
||||||
|
|
||||||
const maxRetryCount = 3;
|
const maxRetryCount = 3;
|
||||||
|
|
||||||
|
@ -167,11 +168,15 @@ export class VariantAnalysisManager
|
||||||
"codeQL.openVariantAnalysisView": this.showView.bind(this),
|
"codeQL.openVariantAnalysisView": this.showView.bind(this),
|
||||||
"codeQL.runVariantAnalysis":
|
"codeQL.runVariantAnalysis":
|
||||||
this.runVariantAnalysisFromCommand.bind(this),
|
this.runVariantAnalysisFromCommand.bind(this),
|
||||||
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.runVariantAnalysis" command
|
|
||||||
"codeQL.runVariantAnalysisContextEditor":
|
"codeQL.runVariantAnalysisContextEditor":
|
||||||
this.runVariantAnalysisFromCommand.bind(this),
|
this.runVariantAnalysisFromCommand.bind(this),
|
||||||
|
"codeQL.runVariantAnalysisContextExplorer": createMultiSelectionCommand(
|
||||||
|
this.runVariantAnalysisFromExplorer.bind(this),
|
||||||
|
),
|
||||||
"codeQLQueries.runVariantAnalysisContextMenu":
|
"codeQLQueries.runVariantAnalysisContextMenu":
|
||||||
this.runVariantAnalysisFromQueriesPanel.bind(this),
|
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(
|
private async runVariantAnalysisFromQueriesPanel(
|
||||||
queryTreeViewItem: QueryTreeViewItem,
|
queryTreeViewItem: QueryTreeViewItem,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -204,6 +216,10 @@ export class VariantAnalysisManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async runVariantAnalysisFromPublishedPack(): Promise<void> {
|
||||||
|
throw new Error("Command not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public async runVariantAnalysis(
|
public async runVariantAnalysis(
|
||||||
uri: Uri | undefined,
|
uri: Uri | undefined,
|
||||||
progress: ProgressCallback,
|
progress: ProgressCallback,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче