Skip to content

Commit 3a32643

Browse files
committed
Run variant analysis from Queries Panel context menu
1 parent 9704b49 commit 3a32643

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

extensions/ql-vscode/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@
510510
"command": "codeQLQueries.runLocalQueryContextMenu",
511511
"title": "Run against local database"
512512
},
513+
{
514+
"command": "codeQLQueries.runVariantAnalysisContextMenu",
515+
"title": "Run against variant analysis repositories"
516+
},
513517
{
514518
"command": "codeQLVariantAnalysisRepositories.openConfigFile",
515519
"title": "Open database configuration file",
@@ -1114,6 +1118,11 @@
11141118
"group": "queriesPanel@1",
11151119
"when": "view == codeQLQueries && viewItem == queryFile && codeQL.currentDatabaseItem"
11161120
},
1121+
{
1122+
"command": "codeQLQueries.runVariantAnalysisContextMenu",
1123+
"group": "queriesPanel@1",
1124+
"when": "view == codeQLQueries && viewItem == queryFile"
1125+
},
11171126
{
11181127
"command": "codeQLTests.showOutputDifferences",
11191128
"group": "qltest@1",
@@ -1301,6 +1310,10 @@
13011310
"command": "codeQLQueries.runLocalQueryContextMenu",
13021311
"when": "false"
13031312
},
1313+
{
1314+
"command": "codeQLQueries.runVariantAnalysisContextMenu",
1315+
"when": "false"
1316+
},
13041317
{
13051318
"command": "codeQLVariantAnalysisRepositories.openConfigFile",
13061319
"when": "false"

extensions/ql-vscode/src/common/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ export type VariantAnalysisCommands = {
265265
) => Promise<void>;
266266
"codeQL.runVariantAnalysis": (uri?: Uri) => Promise<void>;
267267
"codeQL.runVariantAnalysisContextEditor": (uri?: Uri) => Promise<void>;
268+
"codeQLQueries.runVariantAnalysisContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
268269
};
269270

270271
export type DatabasePanelCommands = {

extensions/ql-vscode/src/variant-analysis/variant-analysis-manager.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import {
7676
showAndLogInformationMessage,
7777
showAndLogWarningMessage,
7878
} from "../common/logging";
79+
import type { QueryTreeViewItem } from "../queries-panel/query-tree-view-item";
7980

8081
const maxRetryCount = 3;
8182

@@ -163,6 +164,8 @@ export class VariantAnalysisManager
163164
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.runVariantAnalysis" command
164165
"codeQL.runVariantAnalysisContextEditor":
165166
this.runVariantAnalysisFromCommand.bind(this),
167+
"codeQLQueries.runVariantAnalysisContextMenu":
168+
this.runVariantAnalysisFromQueriesPanel.bind(this),
166169
};
167170
}
168171

@@ -185,6 +188,12 @@ export class VariantAnalysisManager
185188
);
186189
}
187190

191+
private async runVariantAnalysisFromQueriesPanel(
192+
queryTreeViewItem: QueryTreeViewItem,
193+
): Promise<void> {
194+
await this.runVariantAnalysisFromCommand(Uri.file(queryTreeViewItem.path));
195+
}
196+
188197
public async runVariantAnalysis(
189198
uri: Uri | undefined,
190199
progress: ProgressCallback,

0 commit comments

Comments
 (0)