From f1bbe6611d25359ea6b2e7ad77d643e45b9f627f Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 14 Jun 2021 15:51:45 +0200 Subject: [PATCH] Fix workspace folder tasks getting parsed extra times --- .../tasks/browser/abstractTaskService.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index dd82efb25c1..1e13c2dec11 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -2021,7 +2021,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer if (this.executionEngine === ExecutionEngine.Process) { return this.emptyWorkspaceTaskResults(workspaceFolder); } - const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').workspaceValue, nls.localize('TasksSystem.locationWorkspaceConfig', 'workspace file')); + const workspaceFileConfig = this.getConfiguration(workspaceFolder, TaskSourceKind.WorkspaceFile); + const configuration = this.testParseExternalConfig(workspaceFileConfig.config, nls.localize('TasksSystem.locationWorkspaceConfig', 'workspace file')); let customizedTasks: { byIdentifier: IStringDictionary; } = { byIdentifier: Object.create(null) }; @@ -2040,7 +2041,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer if (this.executionEngine === ExecutionEngine.Process) { return this.emptyWorkspaceTaskResults(workspaceFolder); } - const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').userValue, nls.localize('TasksSystem.locationUserConfig', 'user settings')); + const userTasksConfig = this.getConfiguration(workspaceFolder, TaskSourceKind.User); + const configuration = this.testParseExternalConfig(userTasksConfig.config, nls.localize('TasksSystem.locationUserConfig', 'user settings')); let customizedTasks: { byIdentifier: IStringDictionary; } = { byIdentifier: Object.create(null) }; @@ -2157,9 +2159,20 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } else { const wholeConfig = this.configurationService.inspect('tasks', { resource: workspaceFolder.uri }); switch (source) { - case TaskSourceKind.User: result = Objects.deepClone(wholeConfig.userValue); break; + case TaskSourceKind.User: { + if (wholeConfig.userValue !== wholeConfig.workspaceFolderValue) { + result = Objects.deepClone(wholeConfig.userValue); + } + break; + } case TaskSourceKind.Workspace: result = Objects.deepClone(wholeConfig.workspaceFolderValue); break; - case TaskSourceKind.WorkspaceFile: result = Objects.deepClone(wholeConfig.workspaceValue); break; + case TaskSourceKind.WorkspaceFile: { + if ((this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) + && (wholeConfig.workspaceFolderValue !== wholeConfig.workspaceValue)) { + result = Objects.deepClone(wholeConfig.workspaceValue); + } + break; + } default: result = Objects.deepClone(wholeConfig.workspaceFolderValue); } }