Skip to content

Commit 9704b49

Browse files
committed
Run local query from Queries Panel context menu
1 parent 2b48991 commit 9704b49

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

extensions/ql-vscode/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,10 @@
506506
"title": "Run local query",
507507
"icon": "$(run)"
508508
},
509+
{
510+
"command": "codeQLQueries.runLocalQueryContextMenu",
511+
"title": "Run against local database"
512+
},
509513
{
510514
"command": "codeQLVariantAnalysisRepositories.openConfigFile",
511515
"title": "Open database configuration file",
@@ -1105,6 +1109,11 @@
11051109
"group": "inline",
11061110
"when": "view == codeQLQueries && viewItem == queryFile && codeQL.currentDatabaseItem"
11071111
},
1112+
{
1113+
"command": "codeQLQueries.runLocalQueryContextMenu",
1114+
"group": "queriesPanel@1",
1115+
"when": "view == codeQLQueries && viewItem == queryFile && codeQL.currentDatabaseItem"
1116+
},
11081117
{
11091118
"command": "codeQLTests.showOutputDifferences",
11101119
"group": "qltest@1",
@@ -1288,6 +1297,10 @@
12881297
"command": "codeQL.openDataExtensionsEditor",
12891298
"when": "config.codeQL.canary && config.codeQL.dataExtensions.editor"
12901299
},
1300+
{
1301+
"command": "codeQLQueries.runLocalQueryContextMenu",
1302+
"when": "false"
1303+
},
12911304
{
12921305
"command": "codeQLVariantAnalysisRepositories.openConfigFile",
12931306
"when": "false"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export type LocalQueryCommands = {
131131
uri?: Uri,
132132
) => Promise<void>;
133133
"codeQLQueries.runLocalQueryFromQueriesPanel": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
134+
"codeQLQueries.runLocalQueryContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
134135
"codeQL.runQueries": ExplorerSelectionCommandFunction<Uri>;
135136
"codeQL.quickEval": (uri: Uri) => Promise<void>;
136137
"codeQL.quickEvalContextEditor": (uri: Uri) => Promise<void>;

extensions/ql-vscode/src/local-queries/local-queries.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import { SkeletonQueryWizard } from "../skeleton-query-wizard";
4848
import { LocalQueryRun } from "./local-query-run";
4949
import { createMultiSelectionCommand } from "../common/vscode/selection-commands";
5050
import { findLanguage } from "../codeql-cli/query-language";
51-
import { QueryTreeViewItem } from "../queries-panel/query-tree-view-item";
51+
import type { QueryTreeViewItem } from "../queries-panel/query-tree-view-item";
5252

5353
interface DatabaseQuickPickItem extends QuickPickItem {
5454
databaseItem: DatabaseItem;
@@ -103,6 +103,8 @@ export class LocalQueries extends DisposableObject {
103103
this.runQueryOnMultipleDatabases.bind(this),
104104
"codeQLQueries.runLocalQueryFromQueriesPanel":
105105
this.runQueryFromQueriesPanel.bind(this),
106+
"codeQLQueries.runLocalQueryContextMenu":
107+
this.runQueryFromQueriesPanel.bind(this),
106108
"codeQL.runQueries": createMultiSelectionCommand(
107109
this.runQueries.bind(this),
108110
),
@@ -278,7 +280,7 @@ export class LocalQueries extends DisposableObject {
278280
* Gets the current active query.
279281
*
280282
* For now, the "active query" is just whatever query is in the active text editor. Once we have a
281-
* propery "queries" panel, we can provide a way to select the current query there.
283+
* proper "queries" panel, we can provide a way to select the current query there.
282284
*/
283285
public async getCurrentQuery(allowLibraryFiles: boolean): Promise<string> {
284286
const editor = window.activeTextEditor;

0 commit comments

Comments
 (0)