Merge pull request #2547 from github/shati-patel/run-query-context-menu-remote

Run variant analysis from Queries Panel context menu
This commit is contained in:
Shati Patel
2023-06-27 13:38:25 +01:00
committed by GitHub
3 changed files with 23 additions and 0 deletions

View File

@@ -519,6 +519,10 @@
"command": "codeQLQueries.runLocalQueryContextMenu", "command": "codeQLQueries.runLocalQueryContextMenu",
"title": "Run against local database" "title": "Run against local database"
}, },
{
"command": "codeQLQueries.runVariantAnalysisContextMenu",
"title": "Run against variant analysis repositories"
},
{ {
"command": "codeQLVariantAnalysisRepositories.openConfigFile", "command": "codeQLVariantAnalysisRepositories.openConfigFile",
"title": "Open database configuration file", "title": "Open database configuration file",
@@ -1130,6 +1134,11 @@
"group": "queriesPanel@1", "group": "queriesPanel@1",
"when": "view == codeQLQueries && viewItem == queryFile && codeQL.currentDatabaseItem" "when": "view == codeQLQueries && viewItem == queryFile && codeQL.currentDatabaseItem"
}, },
{
"command": "codeQLQueries.runVariantAnalysisContextMenu",
"group": "queriesPanel@1",
"when": "view == codeQLQueries && viewItem == queryFile"
},
{ {
"command": "codeQLTests.showOutputDifferences", "command": "codeQLTests.showOutputDifferences",
"group": "qltest@1", "group": "qltest@1",
@@ -1325,6 +1334,10 @@
"command": "codeQLQueries.runLocalQueryContextMenu", "command": "codeQLQueries.runLocalQueryContextMenu",
"when": "false" "when": "false"
}, },
{
"command": "codeQLQueries.runVariantAnalysisContextMenu",
"when": "false"
},
{ {
"command": "codeQLVariantAnalysisRepositories.openConfigFile", "command": "codeQLVariantAnalysisRepositories.openConfigFile",
"when": "false" "when": "false"

View File

@@ -267,6 +267,7 @@ 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>;
"codeQLQueries.runVariantAnalysisContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
}; };
export type DatabasePanelCommands = { export type DatabasePanelCommands = {

View File

@@ -76,6 +76,7 @@ import {
showAndLogInformationMessage, showAndLogInformationMessage,
showAndLogWarningMessage, showAndLogWarningMessage,
} from "../common/logging"; } from "../common/logging";
import type { QueryTreeViewItem } from "../queries-panel/query-tree-view-item";
const maxRetryCount = 3; const maxRetryCount = 3;
@@ -163,6 +164,8 @@ export class VariantAnalysisManager
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.runVariantAnalysis" command // 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),
"codeQLQueries.runVariantAnalysisContextMenu":
this.runVariantAnalysisFromQueriesPanel.bind(this),
}; };
} }
@@ -185,6 +188,12 @@ export class VariantAnalysisManager
); );
} }
private async runVariantAnalysisFromQueriesPanel(
queryTreeViewItem: QueryTreeViewItem,
): Promise<void> {
await this.runVariantAnalysisFromCommand(Uri.file(queryTreeViewItem.path));
}
public async runVariantAnalysis( public async runVariantAnalysis(
uri: Uri | undefined, uri: Uri | undefined,
progress: ProgressCallback, progress: ProgressCallback,