Skip to content

Commit 8297751

Browse files
authored
Merge pull request #2552 from github/nora/run-all-queries-panel
Queries Panel: run-all queries of a folders
2 parents 32555cc + a591c82 commit 8297751

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

extensions/ql-vscode/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,11 @@
510510
"title": "Run local query",
511511
"icon": "$(run)"
512512
},
513+
{
514+
"command": "codeQLQueries.runLocalQueriesFromPanel",
515+
"title": "Run local queries",
516+
"icon": "$(run-all)"
517+
},
513518
{
514519
"command": "codeQL.runLocalQueryFromFileTab",
515520
"title": "CodeQL: Run local query",
@@ -1139,6 +1144,11 @@
11391144
"group": "queriesPanel@1",
11401145
"when": "view == codeQLQueries && viewItem == queryFile"
11411146
},
1147+
{
1148+
"command": "codeQLQueries.runLocalQueriesFromPanel",
1149+
"group": "inline",
1150+
"when": "view == codeQLQueries && viewItem == queryFolder && codeQL.currentDatabaseItem"
1151+
},
11421152
{
11431153
"command": "codeQLTests.showOutputDifferences",
11441154
"group": "qltest@1",
@@ -1202,6 +1212,10 @@
12021212
"command": "codeQLQueries.runLocalQueryFromQueriesPanel",
12031213
"when": "false"
12041214
},
1215+
{
1216+
"command": "codeQLQueries.runLocalQueriesFromPanel",
1217+
"when": "false"
1218+
},
12051219
{
12061220
"command": "codeQL.runLocalQueryFromFileTab",
12071221
"when": "false"

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

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

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ export class LocalQueries extends DisposableObject {
105105
this.runQueryFromQueriesPanel.bind(this),
106106
"codeQLQueries.runLocalQueryContextMenu":
107107
this.runQueryFromQueriesPanel.bind(this),
108+
"codeQLQueries.runLocalQueriesFromPanel":
109+
this.runQueriesFromQueriesPanel.bind(this),
108110
"codeQL.runLocalQueryFromFileTab": this.runQuery.bind(this),
109111
"codeQL.runQueries": createMultiSelectionCommand(
110112
this.runQueries.bind(this),
@@ -131,6 +133,15 @@ export class LocalQueries extends DisposableObject {
131133
await this.runQuery(Uri.file(queryTreeViewItem.path));
132134
}
133135

136+
private async runQueriesFromQueriesPanel(
137+
queryTreeViewItem: QueryTreeViewItem,
138+
): Promise<void> {
139+
const uris = queryTreeViewItem.children.map((child) =>
140+
Uri.file(child.path),
141+
);
142+
await this.runQueries(uris);
143+
}
144+
134145
private async runQuery(uri: Uri | undefined): Promise<void> {
135146
await withProgress(
136147
async (progress, token) => {

extensions/ql-vscode/src/queries-panel/query-tree-view-item.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class QueryTreeViewItem extends vscode.TreeItem {
2020
};
2121
} else {
2222
this.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
23+
this.contextValue = "queryFolder";
2324
}
2425
}
2526
}

0 commit comments

Comments
 (0)