@@ -327,17 +327,17 @@ async function convertToQlPath(filePath: string): Promise<string> {
327327
328328
329329/** Gets the selected position within the given editor. */
330- async function getSelectedPosition ( editor : TextEditor ) : Promise < messages . Position > {
331- const pos = editor . selection . start ;
332- const posEnd = editor . selection . end ;
333- // Convert from 0-based to 1-based line and column numbers.
334- return {
335- fileName : await convertToQlPath ( editor . document . fileName ) ,
336- line : pos . line + 1 ,
337- column : pos . character + 1 ,
338- endLine : posEnd . line + 1 ,
339- endColumn : posEnd . character + 1
340- } ;
330+ async function getSelectedPosition ( editor : TextEditor , args : any | undefined ) : Promise < messages . Position > {
331+ const pos = editor . selection . start ;
332+ const posEnd = editor . selection . end ;
333+ // Convert from 0-based to 1-based line and column numbers.
334+ return {
335+ fileName : await convertToQlPath ( editor . document . fileName ) ,
336+ line : pos . line + 1 ,
337+ column : pos . character + 1 ,
338+ endLine : posEnd . line + 1 ,
339+ endColumn : posEnd . character + 1
340+ } ;
341341}
342342
343343/**
@@ -485,7 +485,7 @@ type SelectedQuery = {
485485 * @param selectedResourceUri The selected resource when the command was run.
486486 * @param quickEval Whether the command being run is `Quick Evaluation`.
487487*/
488- export async function determineSelectedQuery ( selectedResourceUri : Uri | undefined , quickEval : boolean ) : Promise < SelectedQuery > {
488+ export async function determineSelectedQuery ( selectedResourceUri : Uri | undefined , quickEval : boolean , args : any | undefined ) : Promise < SelectedQuery > {
489489 const editor = window . activeTextEditor ;
490490
491491 // Choose which QL file to use.
@@ -539,7 +539,7 @@ export async function determineSelectedQuery(selectedResourceUri: Uri | undefine
539539 // Report an error if we end up in this (hopefully unlikely) situation.
540540 throw new Error ( 'The selected resource for quick evaluation should match the active editor.' ) ;
541541 }
542- quickEvalPosition = await getSelectedPosition ( editor ) ;
542+ quickEvalPosition = await getSelectedPosition ( editor , args ) ;
543543 quickEvalText = editor . document . getText ( editor . selection ) ;
544544 }
545545
@@ -554,14 +554,15 @@ export async function compileAndRunQueryAgainstDatabase(
554554 selectedQueryUri : Uri | undefined ,
555555 progress : ProgressCallback ,
556556 token : CancellationToken ,
557+ args : any | undefined ,
557558 templates ?: messages . TemplateDefinitions ,
558559) : Promise < QueryWithResults > {
559560 if ( ! db . contents || ! db . contents . dbSchemeUri ) {
560561 throw new Error ( `Database ${ db . databaseUri } does not have a CodeQL database scheme.` ) ;
561562 }
562563
563564 // Determine which query to run, based on the selection and the active editor.
564- const { queryPath, quickEvalPosition, quickEvalText } = await determineSelectedQuery ( selectedQueryUri , quickEval ) ;
565+ const { queryPath, quickEvalPosition, quickEvalText } = await determineSelectedQuery ( selectedQueryUri , quickEval , args ) ;
565566
566567 const historyItemOptions : QueryHistoryItemOptions = { } ;
567568 historyItemOptions . isQuickQuery === isQuickQueryPath ( queryPath ) ;
0 commit comments