Skip to content

Commit 2743486

Browse files
committed
split runVariantAnalysis command
1 parent 1db2bc0 commit 2743486

2 files changed

Lines changed: 41 additions & 15 deletions

File tree

extensions/ql-vscode/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@
322322
"command": "codeQL.runVariantAnalysis",
323323
"title": "CodeQL: Run Variant Analysis"
324324
},
325+
{
326+
"command": "codeQL.runVariantAnalysisContextEditor",
327+
"title": "CodeQL: Run Variant Analysis"
328+
},
325329
{
326330
"command": "codeQL.exportSelectedVariantAnalysisResults",
327331
"title": "CodeQL: Export Variant Analysis Results"
@@ -981,7 +985,8 @@
981985
"when": "editorLangId == ql && resourceExtname == .ql"
982986
},
983987
{
984-
"command": "codeQL.exportSelectedVariantAnalysisResults"
988+
"command": "codeQL.runVariantAnalysisContextEditor",
989+
"when": "false"
985990
},
986991
{
987992
"command": "codeQL.runQueries",
@@ -1234,7 +1239,7 @@
12341239
"when": "editorLangId == ql && resourceExtname == .ql"
12351240
},
12361241
{
1237-
"command": "codeQL.runVariantAnalysis",
1242+
"command": "codeQL.runVariantAnalysisContextEditor",
12381243
"when": "editorLangId == ql && resourceExtname == .ql"
12391244
},
12401245
{

extensions/ql-vscode/src/extension.ts

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,27 +1125,48 @@ async function activateWithInstalledDistribution(
11251125
),
11261126
);
11271127

1128-
// The "runVariantAnalysis" command is internal-only.
1128+
async function runVariantAnalysis(
1129+
progress: ProgressCallback,
1130+
token: CancellationToken,
1131+
uri: Uri | undefined,
1132+
): Promise<void> {
1133+
progress({
1134+
maxStep: 5,
1135+
step: 0,
1136+
message: "Getting credentials",
1137+
});
1138+
1139+
await variantAnalysisManager.runVariantAnalysis(
1140+
uri || window.activeTextEditor?.document.uri,
1141+
progress,
1142+
token,
1143+
);
1144+
}
1145+
11291146
ctx.subscriptions.push(
11301147
commandRunnerWithProgress(
11311148
"codeQL.runVariantAnalysis",
11321149
async (
11331150
progress: ProgressCallback,
11341151
token: CancellationToken,
11351152
uri: Uri | undefined,
1136-
) => {
1137-
progress({
1138-
maxStep: 5,
1139-
step: 0,
1140-
message: "Getting credentials",
1141-
});
1142-
1143-
await variantAnalysisManager.runVariantAnalysis(
1144-
uri || window.activeTextEditor?.document.uri,
1145-
progress,
1146-
token,
1147-
);
1153+
) => await runVariantAnalysis(progress, token, uri),
1154+
{
1155+
title: "Run Variant Analysis",
1156+
cancellable: true,
11481157
},
1158+
),
1159+
);
1160+
1161+
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.runVariantAnalysis" command
1162+
ctx.subscriptions.push(
1163+
commandRunnerWithProgress(
1164+
"codeQL.runVariantAnalysisContextEditor",
1165+
async (
1166+
progress: ProgressCallback,
1167+
token: CancellationToken,
1168+
uri: Uri | undefined,
1169+
) => await runVariantAnalysis(progress, token, uri),
11491170
{
11501171
title: "Run Variant Analysis",
11511172
cancellable: true,

0 commit comments

Comments
 (0)