Fix executeTask for new'd tasks

Fixes #145065
This commit is contained in:
Alex Ross 2022-03-15 11:48:46 +01:00
parent 436b711622
commit 724657e4e3
No known key found for this signature in database
GPG key ID: 89DDDBA66CBA7840

View file

@ -1700,7 +1700,10 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
const taskFolder = task.getWorkspaceFolder();
const taskIdentifier = task.configurationProperties.identifier;
// Since we save before running tasks, the task may have changed as part of the save.
taskToRun = ((taskFolder && taskIdentifier) ? await this.getTask(taskFolder, taskIdentifier) : task) ?? task;
// However, if the TaskRunSource is not User, then we shouldn't try to fetch the task again
// since this can cause a new'd task to get overwritten with a provided task.
taskToRun = ((taskFolder && taskIdentifier && (runSource === TaskRunSource.User))
? await this.getTask(taskFolder, taskIdentifier) : task) ?? task;
}
await ProblemMatcherRegistry.onReady();
let executeResult = this.getTaskSystem().run(taskToRun, resolver);