Skip to content

Commit 16dd2ea

Browse files
committed
Fix configure tasks
Fixes microsoft#101022
1 parent 8e1c83a commit 16dd2ea

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,9 +1064,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
10641064
const eol = model.getEOL();
10651065
const edits = format(JSON.stringify(task), undefined, { eol, tabSize, insertSpaces });
10661066
let stringified = applyEdits(JSON.stringify(task), edits);
1067-
const regex = new RegExp(eol + '\\t', 'g');
1068-
stringified = stringified.replace(regex, eol + '\t\t\t');
1069-
const twoTabs = '\t\t';
1067+
const regex = new RegExp(eol + (insertSpaces ? strings.repeat(' ', tabSize) : '\\t'), 'g');
1068+
stringified = stringified.replace(regex, eol + (insertSpaces ? strings.repeat(' ', tabSize * 3) : '\t\t\t'));
1069+
const twoTabs = insertSpaces ? strings.repeat(' ', tabSize * 2) : '\t\t';
10701070
stringValue = twoTabs + stringified.slice(0, stringified.length - 1) + twoTabs + stringified.slice(stringified.length - 1);
10711071
} finally {
10721072
if (reference) {
@@ -1089,7 +1089,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
10891089
const contentValue = content.toString();
10901090
let stringValue: string | undefined;
10911091
if (configIndex !== -1) {
1092-
const json: TaskConfig.ExternalTaskRunnerConfiguration = JSON.parse(contentValue);
1092+
const json: TaskConfig.ExternalTaskRunnerConfiguration = this.configurationService.getValue<TaskConfig.ExternalTaskRunnerConfiguration>('tasks', { resource });
10931093
if (json.tasks && (json.tasks.length > configIndex)) {
10941094
stringValue = await this.formatTaskForJson(resource, json.tasks[configIndex]);
10951095
}

0 commit comments

Comments
 (0)