From 724657e4e36887345d75b41ceab9293cf4aa7c9b Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 15 Mar 2022 11:48:46 +0100 Subject: [PATCH] Fix executeTask for new'd tasks Fixes #145065 --- .../workbench/contrib/tasks/browser/abstractTaskService.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index 62b66ab4749..70c269e4a69 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -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);