@@ -36,6 +36,8 @@ import { QueryStatus } from './query-status';
3636import { slurpQueryHistory , splatQueryHistory } from './query-serialization' ;
3737import * as fs from 'fs-extra' ;
3838import { CliVersionConstraint } from './cli' ;
39+ import { Credentials } from './authentication' ;
40+ import { cancelRemoteQuery } from './remote-queries/gh-actions-api-client' ;
3941
4042/**
4143 * query-history.ts
@@ -316,7 +318,7 @@ export class QueryHistoryManager extends DisposableObject {
316318 private qs : QueryServerClient ,
317319 private dbm : DatabaseManager ,
318320 private queryStorageDir : string ,
319- ctx : ExtensionContext ,
321+ private ctx : ExtensionContext ,
320322 private queryHistoryConfigListener : QueryHistoryConfig ,
321323 private doCompareCallback : (
322324 from : CompletedLocalQueryInfo ,
@@ -512,6 +514,10 @@ export class QueryHistoryManager extends DisposableObject {
512514 this . registerQueryHistoryScrubber ( queryHistoryConfigListener , ctx ) ;
513515 }
514516
517+ private getCredentials ( ) {
518+ return Credentials . initialize ( this . ctx ) ;
519+ }
520+
515521 /**
516522 * Register and create the history scrubber.
517523 */
@@ -816,7 +822,7 @@ export class QueryHistoryManager extends DisposableObject {
816822 }
817823
818824 if ( finalSingleItem . evalLogSummaryLocation ) {
819- await this . tryOpenExternalFile ( finalSingleItem . evalLogSummaryLocation ) ;
825+ await this . tryOpenExternalFile ( finalSingleItem . evalLogSummaryLocation ) ;
820826 } else {
821827 this . warnNoEvalLogSummary ( ) ;
822828 }
@@ -830,11 +836,20 @@ export class QueryHistoryManager extends DisposableObject {
830836 // In the future, we may support cancelling remote queries, but this is not a short term plan.
831837 const { finalSingleItem, finalMultiSelect } = this . determineSelection ( singleItem , multiSelect ) ;
832838
833- ( finalMultiSelect || [ finalSingleItem ] ) . forEach ( ( item ) => {
834- if ( item . status === QueryStatus . InProgress && item . t === 'local' ) {
835- item . cancel ( ) ;
839+ const selected = finalMultiSelect || [ finalSingleItem ] ;
840+ const results = selected . map ( async item => {
841+ if ( item . status === QueryStatus . InProgress ) {
842+ if ( item . t === 'local' ) {
843+ item . cancel ( ) ;
844+ } else if ( item . t === 'remote' ) {
845+ void showAndLogInformationMessage ( 'Cancelling variant analysis. This may take a while.' ) ;
846+ const credentials = await this . getCredentials ( ) ;
847+ await cancelRemoteQuery ( credentials , item . remoteQuery ) ;
848+ }
836849 }
837850 } ) ;
851+
852+ await Promise . all ( results ) ;
838853 }
839854
840855 async handleShowQueryText (
0 commit comments