@@ -37,6 +37,8 @@ import { slurpQueryHistory, splatQueryHistory } from './query-serialization';
3737import * as fs from 'fs-extra' ;
3838import { CliVersionConstraint } from './cli' ;
3939import { HistoryItemLabelProvider } from './history-item-label-provider' ;
40+ import { Credentials } from './authentication' ;
41+ import { cancelRemoteQuery } from './remote-queries/gh-actions-api-client' ;
4042
4143/**
4244 * query-history.ts
@@ -320,7 +322,7 @@ export class QueryHistoryManager extends DisposableObject {
320322 private readonly qs : QueryServerClient ,
321323 private readonly dbm : DatabaseManager ,
322324 private readonly queryStorageDir : string ,
323- ctx : ExtensionContext ,
325+ private readonly ctx : ExtensionContext ,
324326 private readonly queryHistoryConfigListener : QueryHistoryConfig ,
325327 private readonly labelProvider : HistoryItemLabelProvider ,
326328 private readonly doCompareCallback : (
@@ -518,6 +520,10 @@ export class QueryHistoryManager extends DisposableObject {
518520 this . registerQueryHistoryScrubber ( queryHistoryConfigListener , ctx ) ;
519521 }
520522
523+ private getCredentials ( ) {
524+ return Credentials . initialize ( this . ctx ) ;
525+ }
526+
521527 /**
522528 * Register and create the history scrubber.
523529 */
@@ -836,11 +842,20 @@ export class QueryHistoryManager extends DisposableObject {
836842 // In the future, we may support cancelling remote queries, but this is not a short term plan.
837843 const { finalSingleItem, finalMultiSelect } = this . determineSelection ( singleItem , multiSelect ) ;
838844
839- ( finalMultiSelect || [ finalSingleItem ] ) . forEach ( ( item ) => {
840- if ( item . status === QueryStatus . InProgress && item . t === 'local' ) {
841- item . cancel ( ) ;
845+ const selected = finalMultiSelect || [ finalSingleItem ] ;
846+ const results = selected . map ( async item => {
847+ if ( item . status === QueryStatus . InProgress ) {
848+ if ( item . t === 'local' ) {
849+ item . cancel ( ) ;
850+ } else if ( item . t === 'remote' ) {
851+ void showAndLogInformationMessage ( 'Cancelling variant analysis. This may take a while.' ) ;
852+ const credentials = await this . getCredentials ( ) ;
853+ await cancelRemoteQuery ( credentials , item . remoteQuery ) ;
854+ }
842855 }
843856 } ) ;
857+
858+ await Promise . all ( results ) ;
844859 }
845860
846861 async handleShowQueryText (
0 commit comments