split runVariantAnalysis command

This commit is contained in:
Nora
2023-03-07 09:43:47 +00:00
parent 1db2bc048a
commit 27434862c3
2 changed files with 41 additions and 15 deletions

View File

@@ -322,6 +322,10 @@
"command": "codeQL.runVariantAnalysis",
"title": "CodeQL: Run Variant Analysis"
},
{
"command": "codeQL.runVariantAnalysisContextEditor",
"title": "CodeQL: Run Variant Analysis"
},
{
"command": "codeQL.exportSelectedVariantAnalysisResults",
"title": "CodeQL: Export Variant Analysis Results"
@@ -981,7 +985,8 @@
"when": "editorLangId == ql && resourceExtname == .ql"
},
{
"command": "codeQL.exportSelectedVariantAnalysisResults"
"command": "codeQL.runVariantAnalysisContextEditor",
"when": "false"
},
{
"command": "codeQL.runQueries",
@@ -1234,7 +1239,7 @@
"when": "editorLangId == ql && resourceExtname == .ql"
},
{
"command": "codeQL.runVariantAnalysis",
"command": "codeQL.runVariantAnalysisContextEditor",
"when": "editorLangId == ql && resourceExtname == .ql"
},
{

View File

@@ -1125,7 +1125,24 @@ async function activateWithInstalledDistribution(
),
);
// The "runVariantAnalysis" command is internal-only.
async function runVariantAnalysis(
progress: ProgressCallback,
token: CancellationToken,
uri: Uri | undefined,
): Promise<void> {
progress({
maxStep: 5,
step: 0,
message: "Getting credentials",
});
await variantAnalysisManager.runVariantAnalysis(
uri || window.activeTextEditor?.document.uri,
progress,
token,
);
}
ctx.subscriptions.push(
commandRunnerWithProgress(
"codeQL.runVariantAnalysis",
@@ -1133,19 +1150,23 @@ async function activateWithInstalledDistribution(
progress: ProgressCallback,
token: CancellationToken,
uri: Uri | undefined,
) => {
progress({
maxStep: 5,
step: 0,
message: "Getting credentials",
});
await variantAnalysisManager.runVariantAnalysis(
uri || window.activeTextEditor?.document.uri,
progress,
token,
);
) => await runVariantAnalysis(progress, token, uri),
{
title: "Run Variant Analysis",
cancellable: true,
},
),
);
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.runVariantAnalysis" command
ctx.subscriptions.push(
commandRunnerWithProgress(
"codeQL.runVariantAnalysisContextEditor",
async (
progress: ProgressCallback,
token: CancellationToken,
uri: Uri | undefined,
) => await runVariantAnalysis(progress, token, uri),
{
title: "Run Variant Analysis",
cancellable: true,