Skip to content

Commit 440bade

Browse files
authored
Merge pull request microsoft#187159 from microsoft/merogge/build-task99
clear workspace tasks promise when supported executions change
2 parents c067a3b + 4f1df73 commit 440bade

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
362362
const processContext = ProcessExecutionSupportedContext.bindTo(this._contextKeyService);
363363
processContext.set(process && !isVirtual);
364364
}
365+
// update tasks so an incomplete list isn't returned when getWorkspaceTasks is called
366+
this._workspaceTasksPromise = undefined;
365367
this._onDidRegisterSupportedExecutions.fire();
366368
}
367369

@@ -374,7 +376,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
374376
this._tasksReconnected = true;
375377
return;
376378
}
377-
this.getWorkspaceTasks().then(async () => {
379+
this.getWorkspaceTasks(TaskRunSource.Reconnect).then(async () => {
378380
this._tasksReconnected = await this._reconnectTasks();
379381
});
380382
}
@@ -2352,11 +2354,11 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
23522354
return { workspaceFolder, set: undefined, configurations: undefined, hasErrors: false };
23532355
}
23542356

2355-
private async _computeTasksForSingleConfig(workspaceFolder: IWorkspaceFolder | undefined, config: TaskConfig.IExternalTaskRunnerConfiguration | undefined, runSource: TaskRunSource, custom: CustomTask[], customized: IStringDictionary<ConfiguringTask>, source: TaskConfig.TaskConfigSource, isRecentTask: boolean = false): Promise<boolean> {
2356-
if (!config || !workspaceFolder) {
2357+
private async _computeTasksForSingleConfig(workspaceFolder: IWorkspaceFolder, config: TaskConfig.IExternalTaskRunnerConfiguration | undefined, runSource: TaskRunSource, custom: CustomTask[], customized: IStringDictionary<ConfiguringTask>, source: TaskConfig.TaskConfigSource, isRecentTask: boolean = false): Promise<boolean> {
2358+
if (!config) {
23572359
return false;
23582360
}
2359-
const taskSystemInfo: ITaskSystemInfo | undefined = workspaceFolder ? this._getTaskSystemInfo(workspaceFolder.uri.scheme) : undefined;
2361+
const taskSystemInfo: ITaskSystemInfo | undefined = this._getTaskSystemInfo(workspaceFolder.uri.scheme);
23602362
const problemReporter = new ProblemReporter(this._outputChannel);
23612363
if (!taskSystemInfo) {
23622364
problemReporter.fatal(nls.localize('TaskSystem.workspaceFolderError', 'Workspace folder was undefined'));
@@ -2748,16 +2750,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
27482750
return true;
27492751
}
27502752

2751-
private async _ensureWorkspaceTasks(): Promise<void> {
2752-
if (!this._workspaceTasksPromise) {
2753-
await this.getWorkspaceTasks();
2754-
} else {
2755-
await this._workspaceTasksPromise;
2756-
}
2757-
}
2758-
27592753
private async _runTaskCommand(filter?: string | ITaskIdentifier): Promise<void> {
2760-
await this._ensureWorkspaceTasks();
27612754
if (!filter) {
27622755
return this._doRunTaskCommand();
27632756
}
@@ -2915,7 +2908,6 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
29152908
title: strings.fetching
29162909
};
29172910
const promise = (async () => {
2918-
await this._ensureWorkspaceTasks();
29192911
let taskGroupTasks: (Task | ConfiguringTask)[] = [];
29202912

29212913
async function runSingleTask(task: Task | undefined, problemMatcherOptions: IProblemMatcherRunOptions | undefined, that: AbstractTaskService) {

0 commit comments

Comments
 (0)