Skip to content

Commit ee68156

Browse files
authored
Merge pull request #2547 from github/shati-patel/run-query-context-menu-remote
Run variant analysis from Queries Panel context menu
2 parents b0699ee + 3a32643 commit ee68156

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
@@ -519,6 +519,10 @@
519519
"command": "codeQLQueries.runLocalQueryContextMenu",
520520
"title": "Run against local database"
521521
},
522+
{
523+
"command": "codeQLQueries.runVariantAnalysisContextMenu",
524+
"title": "Run against variant analysis repositories"
525+
},
522526
{
523527
"command": "codeQLVariantAnalysisRepositories.openConfigFile",
524528
"title": "Open database configuration file",
@@ -1130,6 +1134,11 @@
11301134
"group": "queriesPanel@1",
11311135
"when": "view == codeQLQueries && viewItem == queryFile && codeQL.currentDatabaseItem"
11321136
},
1137+
{
1138+
"command": "codeQLQueries.runVariantAnalysisContextMenu",
1139+
"group": "queriesPanel@1",
1140+
"when": "view == codeQLQueries && viewItem == queryFile"
1141+
},
11331142
{
11341143
"command": "codeQLTests.showOutputDifferences",
11351144
"group": "qltest@1",
@@ -1325,6 +1334,10 @@
13251334
"command": "codeQLQueries.runLocalQueryContextMenu",
13261335
"when": "false"
13271336
},
1337+
{
1338+
"command": "codeQLQueries.runVariantAnalysisContextMenu",
1339+
"when": "false"
1340+
},
13281341
{
13291342
"command": "codeQLVariantAnalysisRepositories.openConfigFile",
13301343
"when": "false"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export type VariantAnalysisCommands = {
267267
) => Promise<void>;
268268
"codeQL.runVariantAnalysis": (uri?: Uri) => Promise<void>;
269269
"codeQL.runVariantAnalysisContextEditor": (uri?: Uri) => Promise<void>;
270+
"codeQLQueries.runVariantAnalysisContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
270271
};
271272

272273
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)