Skip to content

Commit 88ffbc7

Browse files
authored
add task.showDecorations setting (microsoft#153851)
fix microsoft#153812
1 parent 14a015a commit 88ffbc7

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

src/vs/workbench/contrib/tasks/browser/task.contribution.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,11 @@ configurationRegistry.registerConfiguration({
496496
description: nls.localize('task.quickOpen.showAll', "Causes the Tasks: Run Task command to use the slower \"show all\" behavior instead of the faster two level picker where tasks are grouped by provider."),
497497
default: false
498498
},
499+
'task.showDecorations': {
500+
type: 'boolean',
501+
description: nls.localize('task.showDecorations', "Shows decorations at points of interest in the terminal buffer such as the first problem found via a watch task. Note that this will only take effect for future tasks."),
502+
default: true
503+
},
499504
'task.saveBeforeRun': {
500505
markdownDescription: nls.localize(
501506
'task.saveBeforeRun',

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

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ import { GroupKind } from 'vs/workbench/contrib/tasks/common/taskConfiguration';
5656
import { Codicon } from 'vs/base/common/codicons';
5757
import { VSCodeOscProperty, VSCodeOscPt, VSCodeSequence } from 'vs/workbench/contrib/terminal/browser/terminalEscapeSequences';
5858

59-
const taskShellIntegrationStartSequence = VSCodeSequence(VSCodeOscPt.PromptStart) + VSCodeSequence(VSCodeOscPt.Property, `${VSCodeOscProperty.Task}=True`) + VSCodeSequence(VSCodeOscPt.CommandStart);
60-
const taskShellIntegrationOutputSequence = VSCodeSequence(VSCodeOscPt.CommandExecuted);
61-
6259
interface ITerminalData {
6360
terminal: ITerminalInstance;
6461
lastTask: string;
@@ -211,6 +208,13 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
211208

212209
private readonly _onDidStateChange: Emitter<ITaskEvent>;
213210

211+
get taskShellIntegrationStartSequence(): string {
212+
return this._configurationService.getValue('task.showDecorations') ? VSCodeSequence(VSCodeOscPt.PromptStart) + VSCodeSequence(VSCodeOscPt.Property, `${VSCodeOscProperty.Task}=True`) + VSCodeSequence(VSCodeOscPt.CommandStart) : '';
213+
}
214+
get taskShellIntegrationOutputSequence(): string {
215+
return this._configurationService.getValue('task.showDecorations') ? VSCodeSequence(VSCodeOscPt.CommandExecuted) : '';
216+
}
217+
214218
constructor(
215219
private _terminalService: ITerminalService,
216220
private _terminalGroupService: ITerminalGroupService,
@@ -1132,18 +1136,18 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
11321136
shellLaunchConfig.args = windowsShellArgs ? combinedShellArgs.join(' ') : combinedShellArgs;
11331137
if (task.command.presentation && task.command.presentation.echo) {
11341138
if (needsFolderQualification && workspaceFolder) {
1135-
shellLaunchConfig.initialText = taskShellIntegrationStartSequence + formatMessageForTerminal(nls.localize({
1139+
shellLaunchConfig.initialText = this.taskShellIntegrationStartSequence + formatMessageForTerminal(nls.localize({
11361140
key: 'task.executingInFolder',
11371141
comment: ['The workspace folder the task is running in', 'The task command line or label']
1138-
}, 'Executing task in folder {0}: {1}', workspaceFolder.name, commandLine), { excludeLeadingNewLine: true }) + taskShellIntegrationOutputSequence;
1142+
}, 'Executing task in folder {0}: {1}', workspaceFolder.name, commandLine), { excludeLeadingNewLine: true }) + this.taskShellIntegrationOutputSequence;
11391143
} else {
1140-
shellLaunchConfig.initialText = taskShellIntegrationStartSequence + formatMessageForTerminal(nls.localize({
1144+
shellLaunchConfig.initialText = this.taskShellIntegrationStartSequence + formatMessageForTerminal(nls.localize({
11411145
key: 'task.executing',
11421146
comment: ['The task command line or label']
1143-
}, 'Executing task: {0}', commandLine), { excludeLeadingNewLine: true }) + taskShellIntegrationOutputSequence;
1147+
}, 'Executing task: {0}', commandLine), { excludeLeadingNewLine: true }) + this.taskShellIntegrationOutputSequence;
11441148
}
11451149
} else {
1146-
shellLaunchConfig.initialText = taskShellIntegrationStartSequence + taskShellIntegrationOutputSequence;
1150+
shellLaunchConfig.initialText = this.taskShellIntegrationStartSequence + this.taskShellIntegrationOutputSequence;
11471151
}
11481152
} else {
11491153
const commandExecutable = (task.command.runtime !== RuntimeType.CustomExecution) ? CommandString.value(command) : undefined;
@@ -1172,18 +1176,18 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
11721176
return args.join(' ');
11731177
};
11741178
if (needsFolderQualification && workspaceFolder) {
1175-
shellLaunchConfig.initialText = taskShellIntegrationStartSequence + formatMessageForTerminal(nls.localize({
1179+
shellLaunchConfig.initialText = this.taskShellIntegrationStartSequence + formatMessageForTerminal(nls.localize({
11761180
key: 'task.executingInFolder',
11771181
comment: ['The workspace folder the task is running in', 'The task command line or label']
1178-
}, 'Executing task in folder {0}: {1}', workspaceFolder.name, `${shellLaunchConfig.executable} ${getArgsToEcho(shellLaunchConfig.args)}`), { excludeLeadingNewLine: true }) + taskShellIntegrationOutputSequence;
1182+
}, 'Executing task in folder {0}: {1}', workspaceFolder.name, `${shellLaunchConfig.executable} ${getArgsToEcho(shellLaunchConfig.args)}`), { excludeLeadingNewLine: true }) + this.taskShellIntegrationOutputSequence;
11791183
} else {
1180-
shellLaunchConfig.initialText = taskShellIntegrationStartSequence + formatMessageForTerminal(nls.localize({
1184+
shellLaunchConfig.initialText = this.taskShellIntegrationStartSequence + formatMessageForTerminal(nls.localize({
11811185
key: 'task.executing',
11821186
comment: ['The task command line or label']
1183-
}, 'Executing task: {0}', `${shellLaunchConfig.executable} ${getArgsToEcho(shellLaunchConfig.args)}`), { excludeLeadingNewLine: true }) + taskShellIntegrationOutputSequence;
1187+
}, 'Executing task: {0}', `${shellLaunchConfig.executable} ${getArgsToEcho(shellLaunchConfig.args)}`), { excludeLeadingNewLine: true }) + this.taskShellIntegrationOutputSequence;
11841188
}
11851189
} else {
1186-
shellLaunchConfig.initialText = taskShellIntegrationStartSequence + taskShellIntegrationOutputSequence;
1190+
shellLaunchConfig.initialText = this.taskShellIntegrationStartSequence + this.taskShellIntegrationOutputSequence;
11871191
}
11881192
}
11891193

0 commit comments

Comments
 (0)