@@ -210,6 +210,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
210210 protected _taskSystemInfos : Map < string , ITaskSystemInfo [ ] > ;
211211
212212 protected _workspaceTasksPromise ?: Promise < Map < string , IWorkspaceFolderTaskResult > > ;
213+ protected readonly _whenTaskSystemReady : Promise < void > ;
213214
214215 protected _taskSystem ?: ITaskSystem ;
215216 protected _taskSystemListeners ?: IDisposable [ ] = [ ] ;
@@ -267,7 +268,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
267268 @IInstantiationService private readonly _instantiationService : IInstantiationService
268269 ) {
269270 super ( ) ;
270-
271+ this . _whenTaskSystemReady = Event . toPromise ( this . onDidChangeTaskSystemInfo ) ;
271272 this . _workspaceTasksPromise = undefined ;
272273 this . _taskSystem = undefined ;
273274 this . _taskSystemListeners = undefined ;
@@ -373,7 +374,6 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
373374 this . _tasksReconnected = true ;
374375 return ;
375376 }
376- this . _getTaskSystem ( ) ;
377377 this . getWorkspaceTasks ( ) . then ( async ( ) => {
378378 this . _tasksReconnected = await this . _reconnectTasks ( ) ;
379379 } ) ;
@@ -2200,9 +2200,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
22002200 return new Map ( ) ;
22012201 }
22022202 await this . _waitForSupportedExecutions ;
2203- // The build task might be run before folder open. On folder open, we need to update the tasks so that
2204- // all tasks are parsed. #173384
2205- if ( runSource !== TaskRunSource . FolderOpen && this . _workspaceTasksPromise ) {
2203+ await this . _whenTaskSystemReady ;
2204+ if ( this . _workspaceTasksPromise ) {
22062205 return this . _workspaceTasksPromise ;
22072206 }
22082207 return this . _updateWorkspaceTasks ( runSource ) ;
0 commit comments