Skip to content

Commit 5fd2596

Browse files
committed
Fix quick-query error in .qll files
Fixes #293
1 parent 22003e1 commit 5fd2596

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ type SelectedQuery = {
313313
* @param selectedResourceUri The selected resource when the command was run.
314314
* @param quickEval Whether the command being run is `Quick Evaluation`.
315315
*/
316-
async function determineSelectedQuery(selectedResourceUri: vscode.Uri | undefined, quickEval: boolean): Promise<SelectedQuery> {
316+
export async function determineSelectedQuery(selectedResourceUri: vscode.Uri | undefined, quickEval: boolean): Promise<SelectedQuery> {
317317
const editor = vscode.window.activeTextEditor;
318318

319319
// Choose which QL file to use.
@@ -336,8 +336,15 @@ async function determineSelectedQuery(selectedResourceUri: vscode.Uri | undefine
336336
}
337337
const queryPath = queryUri.fsPath || '';
338338

339-
if (!queryPath.endsWith('.ql')) {
340-
throw new Error('The selected resource is not a CodeQL query file; It should have the extension ".ql".');
339+
if (quickEval) {
340+
if (!(queryPath.endsWith('.ql') || queryPath.endsWith('.qll'))) {
341+
throw new Error('The selected resource is not a CodeQL file; It should have the extension ".ql" or ".qll".');
342+
}
343+
}
344+
else {
345+
if (!(queryPath.endsWith('.ql'))) {
346+
throw new Error('The selected resource is not a CodeQL query file; It should have the extension ".ql".');
347+
}
341348
}
342349

343350
// Whether we chose the file from the active editor or from a context menu,

0 commit comments

Comments
 (0)