Fix workspace folder tasks getting parsed extra times

This commit is contained in:
Alex Ross 2021-06-14 15:51:45 +02:00
parent cabbe787a2
commit f1bbe6611d
No known key found for this signature in database
GPG key ID: 89DDDBA66CBA7840

View file

@ -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<TaskConfig.ExternalTaskRunnerConfiguration>('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<ConfiguringTask>; } = {
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<TaskConfig.ExternalTaskRunnerConfiguration>('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<ConfiguringTask>; } = {
byIdentifier: Object.create(null)
};
@ -2157,9 +2159,20 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
} else {
const wholeConfig = this.configurationService.inspect<TaskConfig.ExternalTaskRunnerConfiguration>('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);
}
}