@@ -761,10 +761,22 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
761761 }
762762 }
763763
764- private setRecentlyUsedTask ( task : Task ) : void {
765- const key = task . getRecentlyUsedKey ( ) ;
764+ private async setRecentlyUsedTask ( task : Task ) : Promise < void > {
765+ let key = task . getRecentlyUsedKey ( ) ;
766766 if ( ! InMemoryTask . is ( task ) && key ) {
767- this . getRecentlyUsedTasks ( ) . set ( key , JSON . stringify ( this . createCustomizableTask ( task ) ) ) ;
767+ const customizations = this . createCustomizableTask ( task ) ;
768+ if ( ContributedTask . is ( task ) && customizations ) {
769+ let custom : CustomTask [ ] = [ ] ;
770+ let customized : IStringDictionary < ConfiguringTask > = Object . create ( null ) ;
771+ await this . computeTasksForSingleConfig ( task . _source . workspaceFolder ?? this . workspaceFolders [ 0 ] , {
772+ version : '2.0.0' ,
773+ tasks : [ customizations ]
774+ } , TaskRunSource . System , custom , customized , TaskConfig . TaskConfigSource . TasksJson , true ) ;
775+ for ( const configuration in customized ) {
776+ key = customized [ configuration ] . getRecentlyUsedKey ( ) ! ;
777+ }
778+ }
779+ this . getRecentlyUsedTasks ( ) . set ( key , JSON . stringify ( customizations ) ) ;
768780 this . saveRecentlyUsedTasks ( ) ;
769781 }
770782 }
@@ -1398,15 +1410,15 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
13981410 } ) ;
13991411 }
14001412
1401- private handleExecuteResult ( executeResult : ITaskExecuteResult ) : Promise < ITaskSummary > {
1413+ private async handleExecuteResult ( executeResult : ITaskExecuteResult ) : Promise < ITaskSummary > {
14021414 if ( executeResult . task . taskLoadMessages && executeResult . task . taskLoadMessages . length > 0 ) {
14031415 executeResult . task . taskLoadMessages . forEach ( loadMessage => {
14041416 this . _outputChannel . append ( loadMessage + '\n' ) ;
14051417 } ) ;
14061418 this . showOutput ( ) ;
14071419 }
14081420
1409- this . setRecentlyUsedTask ( executeResult . task ) ;
1421+ await this . setRecentlyUsedTask ( executeResult . task ) ;
14101422 if ( executeResult . kind === TaskExecuteKind . Active ) {
14111423 let active = executeResult . active ;
14121424 if ( active && active . same ) {
@@ -1644,7 +1656,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
16441656 await Promise . all ( customTasksPromises ) ;
16451657 if ( needsRecentTasksMigration ) {
16461658 // At this point we have all the tasks and can migrate the recently used tasks.
1647- this . migrateRecentTasks ( result . all ( ) ) ;
1659+ await this . migrateRecentTasks ( result . all ( ) ) ;
16481660 }
16491661 return result ;
16501662 } , ( ) => {
@@ -2244,7 +2256,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
22442256 return ( this . getRecentlyUsedTasksV1 ( ) . size > 0 ) && ( this . getRecentlyUsedTasks ( ) . size === 0 ) ;
22452257 }
22462258
2247- public migrateRecentTasks ( tasks : Task [ ] ) {
2259+ public async migrateRecentTasks ( tasks : Task [ ] ) {
22482260 if ( ! this . needsRecentTasksMigration ( ) ) {
22492261 return ;
22502262 }
@@ -2256,12 +2268,13 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
22562268 taskMap [ key ] = task ;
22572269 }
22582270 } ) ;
2259- recentlyUsedTasks . keys ( ) . reverse ( ) . forEach ( key => {
2271+ const reversed = recentlyUsedTasks . keys ( ) . reverse ( ) ;
2272+ for ( const key in reversed ) {
22602273 let task = taskMap [ key ] ;
22612274 if ( task ) {
2262- this . setRecentlyUsedTask ( task ) ;
2275+ await this . setRecentlyUsedTask ( task ) ;
22632276 }
2264- } ) ;
2277+ }
22652278 this . storageService . remove ( AbstractTaskService . RecentlyUsedTasks_Key , StorageScope . WORKSPACE ) ;
22662279 }
22672280
0 commit comments