Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clear workspace tasks promise when supported executions change #187159

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 6 additions & 14 deletions src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
const processContext = ProcessExecutionSupportedContext.bindTo(this._contextKeyService);
processContext.set(process && !isVirtual);
}
// update tasks so an incomplete list isn't returned when getWorkspaceTasks is called
this._workspaceTasksPromise = undefined;
meganrogge marked this conversation as resolved.
Show resolved Hide resolved
this._onDidRegisterSupportedExecutions.fire();
}

Expand All @@ -374,7 +376,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
this._tasksReconnected = true;
return;
}
this.getWorkspaceTasks().then(async () => {
this.getWorkspaceTasks(TaskRunSource.Reconnect).then(async () => {
this._tasksReconnected = await this._reconnectTasks();
});
}
Expand Down Expand Up @@ -2352,11 +2354,11 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
return { workspaceFolder, set: undefined, configurations: undefined, hasErrors: false };
}

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> {
if (!config || !workspaceFolder) {
private async _computeTasksForSingleConfig(workspaceFolder: IWorkspaceFolder, config: TaskConfig.IExternalTaskRunnerConfiguration | undefined, runSource: TaskRunSource, custom: CustomTask[], customized: IStringDictionary<ConfiguringTask>, source: TaskConfig.TaskConfigSource, isRecentTask: boolean = false): Promise<boolean> {
if (!config) {
return false;
}
const taskSystemInfo: ITaskSystemInfo | undefined = workspaceFolder ? this._getTaskSystemInfo(workspaceFolder.uri.scheme) : undefined;
const taskSystemInfo: ITaskSystemInfo | undefined = this._getTaskSystemInfo(workspaceFolder.uri.scheme);
const problemReporter = new ProblemReporter(this._outputChannel);
if (!taskSystemInfo) {
problemReporter.fatal(nls.localize('TaskSystem.workspaceFolderError', 'Workspace folder was undefined'));
Expand Down Expand Up @@ -2748,16 +2750,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
return true;
}

private async _ensureWorkspaceTasks(): Promise<void> {
if (!this._workspaceTasksPromise) {
await this.getWorkspaceTasks();
} else {
await this._workspaceTasksPromise;
}
}

private async _runTaskCommand(filter?: string | ITaskIdentifier): Promise<void> {
await this._ensureWorkspaceTasks();
if (!filter) {
return this._doRunTaskCommand();
}
Expand Down Expand Up @@ -2915,7 +2908,6 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
title: strings.fetching
};
const promise = (async () => {
await this._ensureWorkspaceTasks();
let taskGroupTasks: (Task | ConfiguringTask)[] = [];

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