@@ -333,10 +333,10 @@ async function convertToQlPath(filePath: string): Promise<string> {
333333
334334
335335/** Gets the selected position within the given editor. */
336- async function getSelectedPosition ( editor : TextEditor , args ?: Range ) : Promise < messages . Position > {
337- const range = args || editor . selection ;
338- const pos = range . start ;
339- const posEnd = range . end ;
336+ async function getSelectedPosition ( editor : TextEditor , range ?: Range ) : Promise < messages . Position > {
337+ const selectedRange = range || editor . selection ;
338+ const pos = selectedRange . start ;
339+ const posEnd = selectedRange . end ;
340340 // Convert from 0-based to 1-based line and column numbers.
341341 return {
342342 fileName : await convertToQlPath ( editor . document . fileName ) ,
@@ -492,7 +492,7 @@ type SelectedQuery = {
492492 * @param selectedResourceUri The selected resource when the command was run.
493493 * @param quickEval Whether the command being run is `Quick Evaluation`.
494494*/
495- export async function determineSelectedQuery ( selectedResourceUri : Uri | undefined , quickEval : boolean , args ?: Range ) : Promise < SelectedQuery > {
495+ export async function determineSelectedQuery ( selectedResourceUri : Uri | undefined , quickEval : boolean , range ?: Range ) : Promise < SelectedQuery > {
496496 const editor = window . activeTextEditor ;
497497
498498 // Choose which QL file to use.
@@ -546,7 +546,7 @@ export async function determineSelectedQuery(selectedResourceUri: Uri | undefine
546546 // Report an error if we end up in this (hopefully unlikely) situation.
547547 throw new Error ( 'The selected resource for quick evaluation should match the active editor.' ) ;
548548 }
549- quickEvalPosition = await getSelectedPosition ( editor , args ) ;
549+ quickEvalPosition = await getSelectedPosition ( editor , range ) ;
550550 quickEvalText = editor . document . getText ( editor . selection ) ;
551551 }
552552
@@ -562,14 +562,14 @@ export async function compileAndRunQueryAgainstDatabase(
562562 progress : ProgressCallback ,
563563 token : CancellationToken ,
564564 templates ?: messages . TemplateDefinitions ,
565- args ?: Range
565+ range ?: Range
566566) : Promise < QueryWithResults > {
567567 if ( ! db . contents || ! db . contents . dbSchemeUri ) {
568568 throw new Error ( `Database ${ db . databaseUri } does not have a CodeQL database scheme.` ) ;
569569 }
570570
571571 // Determine which query to run, based on the selection and the active editor.
572- const { queryPath, quickEvalPosition, quickEvalText } = await determineSelectedQuery ( selectedQueryUri , quickEval , args ) ;
572+ const { queryPath, quickEvalPosition, quickEvalText } = await determineSelectedQuery ( selectedQueryUri , quickEval , range ) ;
573573
574574 const historyItemOptions : QueryHistoryItemOptions = { } ;
575575 historyItemOptions . isQuickQuery === isQuickQueryPath ( queryPath ) ;
0 commit comments