提交 49d5cc6e 编写于 作者: D Dirk Baeumer

Remove 'terminal' as a used term from tasks.

上级 c1b48cb2
...@@ -485,14 +485,18 @@ export class LinkedMap<K, V> { ...@@ -485,14 +485,18 @@ export class LinkedMap<K, V> {
} }
public delete(key: K): boolean { public delete(key: K): boolean {
return !!this.remove(key);
}
public remove(key: K): V | undefined {
const item = this._map.get(key); const item = this._map.get(key);
if (!item) { if (!item) {
return false; return undefined;
} }
this._map.delete(key); this._map.delete(key);
this.removeItem(item); this.removeItem(item);
this._size--; this._size--;
return true; return item.value;
} }
public shift(): V | undefined { public shift(): V | undefined {
......
...@@ -31,49 +31,52 @@ declare module 'vscode' { ...@@ -31,49 +31,52 @@ declare module 'vscode' {
/** /**
* Controls how the task channel is used between tasks * Controls how the task channel is used between tasks
*/ */
export enum TaskInstanceKind { export enum TaskPanelKind {
/** /**
* Shares a channel with other tasks. This is the default. * Shares a panel with other tasks. This is the default.
*/ */
Shared = 1, Shared = 1,
/** /**
* Uses the same task channel for every run if possible. The task channel is not * Uses a dedicated panel for this tasks. The panel is not
* shared with other tasks. * shared with other tasks.
*/ */
Same = 2, Dedicated = 2,
/** /**
* Creates a new task channel whenever that task is executed * Creates a new panel whenever this task is executed.
*/ */
New = 3 New = 3
} }
/** /**
* Controls terminal specific behavior. * Controls how the task is presented in the UI.
*/ */
export interface TaskTerminalBehavior { export interface TaskPresentationOptions {
/** /**
* Controls whether the terminal executing a task is brought to front or not. * Controls whether the task output is reveal in the user interface.
* Defaults to `RevealKind.Always`. * Defaults to `RevealKind.Always`.
*/ */
reveal?: TaskRevealKind; reveal?: TaskRevealKind;
/** /**
* Controls whether the command is echoed in the terminal or not. * Controls whether the command associated with the task is echoed
* in the user interface.
*/ */
echo?: boolean; echo?: boolean;
/** /**
* Controls whether the task pane takes focus when the task is executed * Controls whether the panel showing the task output is taking focus.
*/ */
focus?: boolean; focus?: boolean;
/** /**
* Controls in which pane the task is executed. * Controls if the task panel is used for this task only (dedicated),
* shared between tasks (shared) or if a new panel is created on
* every task execution (new). Defaults to `TaskInstanceKind.Shared`
*/ */
instance?: TaskInstanceKind; panel?: TaskPanelKind;
} }
export interface ProcessTaskOptions { export interface ProcessTaskOptions {
...@@ -200,9 +203,9 @@ declare module 'vscode' { ...@@ -200,9 +203,9 @@ declare module 'vscode' {
options: ProcessTaskOptions; options: ProcessTaskOptions;
/** /**
* The terminal behavior. Defaults to an empty object literal. * The presentation options. Defaults to an empty literal.
*/ */
terminalBehavior: TaskTerminalBehavior; presentationOptions: TaskPresentationOptions;
/** /**
* The problem matchers attached to the task. Defaults to an empty * The problem matchers attached to the task. Defaults to an empty
...@@ -332,9 +335,9 @@ declare module 'vscode' { ...@@ -332,9 +335,9 @@ declare module 'vscode' {
options: ShellTaskOptions; options: ShellTaskOptions;
/** /**
* The terminal behavior. Defaults to an empty object literal. * The presentation options. Defaults to an empty literal.
*/ */
terminalBehavior: TaskTerminalBehavior; presentationOptions: TaskPresentationOptions;
/** /**
* The problem matchers attached to the task. Defaults to an empty * The problem matchers attached to the task. Defaults to an empty
......
...@@ -489,7 +489,7 @@ export function createApiFactory( ...@@ -489,7 +489,7 @@ export function createApiFactory(
ThemeColor: extHostTypes.ThemeColor, ThemeColor: extHostTypes.ThemeColor,
// functions // functions
TaskRevealKind: extHostTypes.TaskRevealKind, TaskRevealKind: extHostTypes.TaskRevealKind,
TaskInstanceKind: extHostTypes.TaskInstanceKind, TaskPanelKind: extHostTypes.TaskPanelKind,
TaskGroup: extHostTypes.TaskGroup, TaskGroup: extHostTypes.TaskGroup,
ShellTask: extHostTypes.ShellTask, ShellTask: extHostTypes.ShellTask,
ProcessTask: extHostTypes.ProcessTask ProcessTask: extHostTypes.ProcessTask
......
...@@ -207,32 +207,32 @@ namespace TaskRevealKind { ...@@ -207,32 +207,32 @@ namespace TaskRevealKind {
} }
} }
namespace TaskInstanceKind { namespace TaskPanelKind {
export function from(value: vscode.TaskInstanceKind): TaskSystem.InstanceKind { export function from(value: vscode.TaskPanelKind): TaskSystem.PanelKind {
if (value === void 0 || value === null) { if (value === void 0 || value === null) {
return TaskSystem.InstanceKind.Shared; return TaskSystem.PanelKind.Shared;
} }
switch (value) { switch (value) {
case types.TaskInstanceKind.Same: case types.TaskPanelKind.Dedicated:
return TaskSystem.InstanceKind.Same; return TaskSystem.PanelKind.Dedicated;
case types.TaskInstanceKind.New: case types.TaskPanelKind.New:
return TaskSystem.InstanceKind.New; return TaskSystem.PanelKind.New;
default: default:
return TaskSystem.InstanceKind.Shared; return TaskSystem.PanelKind.Shared;
} }
} }
} }
namespace TerminalBehaviour { namespace PresentationOptions {
export function from(value: vscode.TaskTerminalBehavior): TaskSystem.TerminalBehavior { export function from(value: vscode.TaskPresentationOptions): TaskSystem.PresentationOptions {
if (value === void 0 || value === null) { if (value === void 0 || value === null) {
return { reveal: TaskSystem.RevealKind.Always, echo: true, focus: false, instance: TaskSystem.InstanceKind.Shared }; return { reveal: TaskSystem.RevealKind.Always, echo: true, focus: false, panel: TaskSystem.PanelKind.Shared };
} }
return { return {
reveal: TaskRevealKind.from(value.reveal), reveal: TaskRevealKind.from(value.reveal),
echo: value.echo === void 0 ? true : !!value.echo, echo: value.echo === void 0 ? true : !!value.echo,
focus: !!value.focus, focus: !!value.focus,
instance: TaskInstanceKind.from(value.instance) panel: TaskPanelKind.from(value.panel)
}; };
} }
} }
...@@ -359,7 +359,7 @@ namespace Tasks { ...@@ -359,7 +359,7 @@ namespace Tasks {
args: Strings.from(value.args), args: Strings.from(value.args),
type: TaskSystem.CommandType.Process, type: TaskSystem.CommandType.Process,
suppressTaskName: true, suppressTaskName: true,
terminalBehavior: TerminalBehaviour.from(value.terminalBehavior) presentation: PresentationOptions.from(value.presentationOptions)
}; };
if (value.options) { if (value.options) {
result.options = CommandOptions.from(value.options); result.options = CommandOptions.from(value.options);
...@@ -374,7 +374,7 @@ namespace Tasks { ...@@ -374,7 +374,7 @@ namespace Tasks {
let result: TaskSystem.CommandConfiguration = { let result: TaskSystem.CommandConfiguration = {
name: value.commandLine, name: value.commandLine,
type: TaskSystem.CommandType.Shell, type: TaskSystem.CommandType.Shell,
terminalBehavior: TerminalBehaviour.from(value.terminalBehavior) presentation: PresentationOptions.from(value.presentationOptions)
}; };
if (value.options) { if (value.options) {
result.options = CommandOptions.from(value.options); result.options = CommandOptions.from(value.options);
......
...@@ -1037,10 +1037,10 @@ export enum TaskRevealKind { ...@@ -1037,10 +1037,10 @@ export enum TaskRevealKind {
Never = 3 Never = 3
} }
export enum TaskInstanceKind { export enum TaskPanelKind {
Shared = 1, Shared = 1,
Same = 2, Dedicated = 2,
New = 3 New = 3
} }
...@@ -1053,7 +1053,7 @@ export class BaseTask { ...@@ -1053,7 +1053,7 @@ export class BaseTask {
private _isBackground: boolean; private _isBackground: boolean;
private _source: string; private _source: string;
private _group: string; private _group: string;
private _terminalBehavior: vscode.TaskTerminalBehavior; private _presentationOptions: vscode.TaskPresentationOptions;
constructor(name: string, problemMatchers: string[]) { constructor(name: string, problemMatchers: string[]) {
if (typeof name !== 'string') { if (typeof name !== 'string') {
...@@ -1062,7 +1062,7 @@ export class BaseTask { ...@@ -1062,7 +1062,7 @@ export class BaseTask {
this._name = name; this._name = name;
this._problemMatchers = problemMatchers || []; this._problemMatchers = problemMatchers || [];
this._isBackground = false; this._isBackground = false;
this._terminalBehavior = Object.create(null); this._presentationOptions = Object.create(null);
} }
get identifier(): string { get identifier(): string {
...@@ -1124,15 +1124,15 @@ export class BaseTask { ...@@ -1124,15 +1124,15 @@ export class BaseTask {
this._group = value; this._group = value;
} }
get terminalBehavior(): vscode.TaskTerminalBehavior { get presentationOptions(): vscode.TaskPresentationOptions {
return this._terminalBehavior; return this._presentationOptions;
} }
set terminalBehavior(value: vscode.TaskTerminalBehavior) { set presentationOptions(value: vscode.TaskPresentationOptions) {
if (value === void 0 || value === null) { if (value === void 0 || value === null) {
value = Object.create(null); value = Object.create(null);
} }
this._terminalBehavior = value; this._presentationOptions = value;
} }
get problemMatchers(): string[] { get problemMatchers(): string[] {
......
...@@ -26,7 +26,7 @@ class TaskEntry extends base.TaskEntry { ...@@ -26,7 +26,7 @@ class TaskEntry extends base.TaskEntry {
} }
let task = this._task; let task = this._task;
this.taskService.run(task); this.taskService.run(task);
if (task.command.terminalBehavior.focus) { if (task.command.presentation.focus) {
this.quickOpenService.close(); this.quickOpenService.close();
return false; return false;
} }
......
...@@ -28,7 +28,7 @@ class TaskEntry extends base.TaskEntry { ...@@ -28,7 +28,7 @@ class TaskEntry extends base.TaskEntry {
} }
let task = this._task; let task = this._task;
this.taskService.run(task); this.taskService.run(task);
if (task.command.terminalBehavior.focus) { if (task.command.presentation.focus) {
this.quickOpenService.close(); this.quickOpenService.close();
return false; return false;
} }
......
...@@ -26,7 +26,7 @@ class TaskEntry extends base.TaskEntry { ...@@ -26,7 +26,7 @@ class TaskEntry extends base.TaskEntry {
} }
let task = this._task; let task = this._task;
this.taskService.run(task); this.taskService.run(task);
if (task.command.terminalBehavior.focus) { if (task.command.presentation.focus) {
this.quickOpenService.close(); this.quickOpenService.close();
return false; return false;
} }
......
...@@ -234,16 +234,27 @@ export interface BaseTaskRunnerConfiguration { ...@@ -234,16 +234,27 @@ export interface BaseTaskRunnerConfiguration {
/** /**
* Controls the behavior of the used terminal * Controls the behavior of the used terminal
*/ */
terminal?: { presentation?: {
/** /**
* The terminal should echo the run command. * Controls whether the terminal executing a task is brought to front or not.
* Defaults to `RevealKind.Always`.
*/
reveal?: string;
/**
* Controls whether the executed command is printed to the output window or terminal as well.
*/ */
echo?: boolean; echo?: boolean;
/** /**
* Controls whether or not the terminal is reveal if a task * Controls whether the terminal is focus when this task is executed
* is executed.
*/ */
reveal?: string; focus?: boolean;
/**
* Controls whether the task runs in a new terminal
*/
panel?: string;
}; };
/** /**
...@@ -596,11 +607,11 @@ namespace CommandOptions { ...@@ -596,11 +607,11 @@ namespace CommandOptions {
namespace CommandConfiguration { namespace CommandConfiguration {
interface TerminalBehavior { interface PresentationOptions {
echo?: boolean; echo?: boolean;
reveal?: string; reveal?: string;
focus?: boolean; focus?: boolean;
instance?: string; panel?: string;
} }
interface BaseCommandConfiguationShape { interface BaseCommandConfiguationShape {
...@@ -611,7 +622,11 @@ namespace CommandConfiguration { ...@@ -611,7 +622,11 @@ namespace CommandConfiguration {
options?: CommandOptions; options?: CommandOptions;
echoCommand?: boolean; echoCommand?: boolean;
showOutput?: string; showOutput?: string;
terminal?: TerminalBehavior; /**
* @deprecated Use panel instead.
*/
terminal?: PresentationOptions;
presentation?: PresentationOptions;
taskSelector?: string; taskSelector?: string;
suppressTaskName?: boolean; suppressTaskName?: boolean;
} }
...@@ -622,66 +637,67 @@ namespace CommandConfiguration { ...@@ -622,66 +637,67 @@ namespace CommandConfiguration {
linux?: BaseCommandConfiguationShape; linux?: BaseCommandConfiguationShape;
} }
export namespace TerminalBehavior { export namespace PresentationOptions {
const properties: MetaData<Tasks.TerminalBehavior, void>[] = [{ property: 'echo' }, { property: 'reveal' }, { property: 'focus' }, { property: 'instance' }]; const properties: MetaData<Tasks.PresentationOptions, void>[] = [{ property: 'echo' }, { property: 'reveal' }, { property: 'focus' }, { property: 'panel' }];
export function from(this: void, config: BaseCommandConfiguationShape, context: ParseContext): Tasks.TerminalBehavior { export function from(this: void, config: BaseCommandConfiguationShape, context: ParseContext): Tasks.PresentationOptions {
let echo: boolean; let echo: boolean;
let reveal: Tasks.RevealKind; let reveal: Tasks.RevealKind;
let focus: boolean; let focus: boolean;
let instance: Tasks.InstanceKind; let panel: Tasks.PanelKind;
if (Types.isBoolean(config.echoCommand)) { if (Types.isBoolean(config.echoCommand)) {
echo = config.echoCommand; echo = config.echoCommand;
} }
if (Types.isString(config.showOutput)) { if (Types.isString(config.showOutput)) {
reveal = Tasks.RevealKind.fromString(config.showOutput); reveal = Tasks.RevealKind.fromString(config.showOutput);
} }
if (config.terminal) { let presentation = config.presentation || config.terminal;
if (Types.isBoolean(config.terminal.echo)) { if (presentation) {
echo = config.terminal.echo; if (Types.isBoolean(presentation.echo)) {
echo = presentation.echo;
} }
if (Types.isString(config.terminal.reveal)) { if (Types.isString(presentation.reveal)) {
reveal = Tasks.RevealKind.fromString(config.terminal.reveal); reveal = Tasks.RevealKind.fromString(presentation.reveal);
} }
if (Types.isBoolean(config.terminal.focus)) { if (Types.isBoolean(presentation.focus)) {
focus = config.terminal.focus; focus = presentation.focus;
} }
if (Types.isString(config.terminal.instance)) { if (Types.isString(presentation.panel)) {
instance = Tasks.InstanceKind.fromString(config.terminal.instance); panel = Tasks.PanelKind.fromString(presentation.panel);
} }
} }
if (echo === void 0 && reveal === void 0 && focus === void 0 && instance === void 0) { if (echo === void 0 && reveal === void 0 && focus === void 0 && panel === void 0) {
return undefined; return undefined;
} }
return { echo, reveal, focus, instance }; return { echo, reveal, focus, panel };
} }
export function assignProperties(target: Tasks.TerminalBehavior, source: Tasks.TerminalBehavior): Tasks.TerminalBehavior { export function assignProperties(target: Tasks.PresentationOptions, source: Tasks.PresentationOptions): Tasks.PresentationOptions {
return _assignProperties(target, source, properties); return _assignProperties(target, source, properties);
} }
export function fillProperties(target: Tasks.TerminalBehavior, source: Tasks.TerminalBehavior): Tasks.TerminalBehavior { export function fillProperties(target: Tasks.PresentationOptions, source: Tasks.PresentationOptions): Tasks.PresentationOptions {
return _fillProperties(target, source, properties); return _fillProperties(target, source, properties);
} }
export function fillDefaults(value: Tasks.TerminalBehavior, context: ParseContext): Tasks.TerminalBehavior { export function fillDefaults(value: Tasks.PresentationOptions, context: ParseContext): Tasks.PresentationOptions {
let defaultEcho = context.engine === Tasks.ExecutionEngine.Terminal ? true : false; let defaultEcho = context.engine === Tasks.ExecutionEngine.Terminal ? true : false;
return _fillDefaults(value, { echo: defaultEcho, reveal: Tasks.RevealKind.Always, focus: false, instance: Tasks.InstanceKind.Shared }, properties, context); return _fillDefaults(value, { echo: defaultEcho, reveal: Tasks.RevealKind.Always, focus: false, panel: Tasks.PanelKind.Shared }, properties, context);
} }
export function freeze(value: Tasks.TerminalBehavior): Readonly<Tasks.TerminalBehavior> { export function freeze(value: Tasks.PresentationOptions): Readonly<Tasks.PresentationOptions> {
return _freeze(value, properties); return _freeze(value, properties);
} }
export function isEmpty(this: void, value: Tasks.TerminalBehavior): boolean { export function isEmpty(this: void, value: Tasks.PresentationOptions): boolean {
return _isEmpty(value, properties); return _isEmpty(value, properties);
} }
} }
const properties: MetaData<Tasks.CommandConfiguration, CommandOptions | TerminalBehavior>[] = [ const properties: MetaData<Tasks.CommandConfiguration, CommandOptions | PresentationOptions>[] = [
{ property: 'type' }, { property: 'name' }, { property: 'options', type: CommandOptions }, { property: 'type' }, { property: 'name' }, { property: 'options', type: CommandOptions },
{ property: 'args' }, { property: 'taskSelector' }, { property: 'suppressTaskName' }, { property: 'args' }, { property: 'taskSelector' }, { property: 'suppressTaskName' },
{ property: 'terminalBehavior', type: TerminalBehavior } { property: 'presentation', type: PresentationOptions }
]; ];
export function from(this: void, config: CommandConfiguationShape, context: ParseContext): Tasks.CommandConfiguration { export function from(this: void, config: CommandConfiguationShape, context: ParseContext): Tasks.CommandConfiguration {
...@@ -705,7 +721,7 @@ namespace CommandConfiguration { ...@@ -705,7 +721,7 @@ namespace CommandConfiguration {
let result: Tasks.CommandConfiguration = { let result: Tasks.CommandConfiguration = {
name: undefined, name: undefined,
type: undefined, type: undefined,
terminalBehavior: undefined presentation: undefined
}; };
if (Types.isString(config.command)) { if (Types.isString(config.command)) {
result.name = config.command; result.name = config.command;
...@@ -735,9 +751,9 @@ namespace CommandConfiguration { ...@@ -735,9 +751,9 @@ namespace CommandConfiguration {
} }
} }
} }
let terminal = TerminalBehavior.from(config, context); let panel = PresentationOptions.from(config, context);
if (terminal) { if (panel) {
result.terminalBehavior = terminal; result.presentation = panel;
} }
if (Types.isString(config.taskSelector)) { if (Types.isString(config.taskSelector)) {
result.taskSelector = config.taskSelector; result.taskSelector = config.taskSelector;
...@@ -754,7 +770,7 @@ namespace CommandConfiguration { ...@@ -754,7 +770,7 @@ namespace CommandConfiguration {
export function onlyTerminalBehaviour(value: Tasks.CommandConfiguration): boolean { export function onlyTerminalBehaviour(value: Tasks.CommandConfiguration): boolean {
return value && return value &&
value.terminalBehavior && (value.terminalBehavior.echo !== void 0 || value.terminalBehavior.reveal !== void 0) && value.presentation && (value.presentation.echo !== void 0 || value.presentation.reveal !== void 0) &&
value.name === void 0 && value.type === void 0 && value.args === void 0 && CommandOptions.isEmpty(value.options); value.name === void 0 && value.type === void 0 && value.args === void 0 && CommandOptions.isEmpty(value.options);
} }
...@@ -776,7 +792,7 @@ namespace CommandConfiguration { ...@@ -776,7 +792,7 @@ namespace CommandConfiguration {
target.args = target.args.concat(source.args); target.args = target.args.concat(source.args);
} }
} }
target.terminalBehavior = TerminalBehavior.assignProperties(target.terminalBehavior, source.terminalBehavior); target.presentation = PresentationOptions.assignProperties(target.presentation, source.presentation);
target.options = CommandOptions.assignProperties(target.options, source.options); target.options = CommandOptions.assignProperties(target.options, source.options);
return target; return target;
} }
...@@ -788,14 +804,14 @@ namespace CommandConfiguration { ...@@ -788,14 +804,14 @@ namespace CommandConfiguration {
target = target || { target = target || {
name: undefined, name: undefined,
type: undefined, type: undefined,
terminalBehavior: undefined presentation: undefined
}; };
fillProperty(target, source, 'name'); fillProperty(target, source, 'name');
fillProperty(target, source, 'type'); fillProperty(target, source, 'type');
fillProperty(target, source, 'taskSelector'); fillProperty(target, source, 'taskSelector');
fillProperty(target, source, 'suppressTaskName'); fillProperty(target, source, 'suppressTaskName');
target.terminalBehavior = TerminalBehavior.fillProperties(target.terminalBehavior, source.terminalBehavior); target.presentation = PresentationOptions.fillProperties(target.presentation, source.presentation);
target.options = CommandOptions.fillProperties(target.options, source.options); target.options = CommandOptions.fillProperties(target.options, source.options);
let args: string[] = source.args ? source.args.slice() : []; let args: string[] = source.args ? source.args.slice() : [];
...@@ -820,7 +836,7 @@ namespace CommandConfiguration { ...@@ -820,7 +836,7 @@ namespace CommandConfiguration {
if (value.name !== void 0 && value.type === void 0) { if (value.name !== void 0 && value.type === void 0) {
value.type = Tasks.CommandType.Process; value.type = Tasks.CommandType.Process;
} }
value.terminalBehavior = TerminalBehavior.fillDefaults(value.terminalBehavior, context); value.presentation = PresentationOptions.fillDefaults(value.presentation, context);
if (!isEmpty(value)) { if (!isEmpty(value)) {
value.options = CommandOptions.fillDefaults(value.options, context); value.options = CommandOptions.fillDefaults(value.options, context);
} }
...@@ -1415,7 +1431,7 @@ class ConfigurationParser { ...@@ -1415,7 +1431,7 @@ class ConfigurationParser {
command: { command: {
name: undefined, name: undefined,
type: undefined, type: undefined,
terminalBehavior: undefined, presentation: undefined,
suppressTaskName: true suppressTaskName: true
}, },
isBackground: isBackground, isBackground: isBackground,
......
...@@ -80,61 +80,64 @@ export namespace RevealKind { ...@@ -80,61 +80,64 @@ export namespace RevealKind {
} }
} }
export enum InstanceKind { export enum PanelKind {
/** /**
* Shares a terminal with other tasks. This is the default. * Shares a panel with other tasks. This is the default.
*/ */
Shared = 1, Shared = 1,
/** /**
* Uses the same terminal for every run if possible. The terminal is not * Uses a dedicated panel for this tasks. The panel is not
* shared with other tasks. * shared with other tasks.
*/ */
Same = 2, Dedicated = 2,
/** /**
* Creates a new terminal whenever that task is executed * Creates a new panel whenever this task is executed.
*/ */
New = 3 New = 3
} }
export namespace InstanceKind { export namespace PanelKind {
export function fromString(value: string): InstanceKind { export function fromString(value: string): PanelKind {
switch (value.toLowerCase()) { switch (value.toLowerCase()) {
case 'shared': case 'shared':
return InstanceKind.Shared; return PanelKind.Shared;
case 'same': case 'dedicated':
return InstanceKind.Same; return PanelKind.Dedicated;
case 'new': case 'new':
return InstanceKind.New; return PanelKind.New;
default: default:
return InstanceKind.Shared; return PanelKind.Shared;
} }
} }
} }
export interface TerminalBehavior { export interface PresentationOptions {
/** /**
* Controls whether the terminal executing a task is brought to front or not. * Controls whether the task output is reveal in the user interface.
* Defaults to `RevealKind.Always`. * Defaults to `RevealKind.Always`.
*/ */
reveal: RevealKind; reveal: RevealKind;
/** /**
* Controls whether the executed command is printed to the output window or terminal as well. * Controls whether the command associated with the task is echoed
* in the user interface.
*/ */
echo: boolean; echo: boolean;
/** /**
* Controls whether the terminal is focus when this task is executed * Controls whether the panel showing the task output is taking focus.
*/ */
focus: boolean; focus: boolean;
/** /**
* Controls whether the task runs in a new terminal * Controls if the task panel is used for this task only (dedicated),
* shared between tasks (shared) or if a new panel is created on
* every task execution (new). Defaults to `TaskInstanceKind.Shared`
*/ */
instance: InstanceKind; panel: PanelKind;
} }
export enum CommandType { export enum CommandType {
...@@ -189,9 +192,9 @@ export interface CommandConfiguration { ...@@ -189,9 +192,9 @@ export interface CommandConfiguration {
suppressTaskName?: boolean; suppressTaskName?: boolean;
/** /**
* Describes how the terminal is supposed to behave. * Describes how the task is presented in the UI.
*/ */
terminalBehavior: TerminalBehavior; presentation: PresentationOptions;
} }
export namespace TaskGroup { export namespace TaskGroup {
......
...@@ -43,23 +43,35 @@ const dependsOn: IJSONSchema = { ...@@ -43,23 +43,35 @@ const dependsOn: IJSONSchema = {
] ]
}; };
const terminal: IJSONSchema = { const presentation: IJSONSchema = {
type: 'object', type: 'object',
default: { default: {
reveal: 'always' reveal: 'always'
}, },
description: nls.localize('JsonSchema.tasks.terminal', 'Configures the terminal that is used to execute the task.'), description: nls.localize('JsonSchema.tasks.terminal', 'Configures the panel that is used to present the task\'s ouput and reads its input.'),
additionalProperties: false,
properties: { properties: {
echo: { echo: {
type: 'boolean',
default: true,
description: nls.localize('JsonSchema.tasks.terminal.echo', 'Controls whether the executed command is echoed to the panel. Default is true.')
},
focus: {
type: 'boolean', type: 'boolean',
default: false, default: false,
description: nls.localize('JsonSchema.tasks.terminal.echo', 'Controls whether the executed command is echoed to the terminal. Default is false.') description: nls.localize('JsonSchema.tasks.terminal.focus', 'Controls whether the panel takes focus. Default is false. If set to true the panel is revealed as well.')
}, },
reveal: { reveal: {
type: 'string', type: 'string',
enum: ['always', 'silent', 'never'], enum: ['always', 'silent', 'never'],
default: 'always', default: 'always',
description: nls.localize('JsonSchema.tasks.terminal.reveals', 'Controls whether the terminal running the task is revealed or not. Default is \"always\".') description: nls.localize('JsonSchema.tasks.terminal.reveals', 'Controls whether the panel running the task is revealed or not. Default is \"always\".')
},
panel: {
type: 'string',
enum: ['shared', 'dedicated', 'new'],
default: 'shared',
description: nls.localize('JsonSchema.tasks.terminal.instance', 'Controls if the panel is shared between tasks, dedicated to this task or a new one is created on every run.')
} }
} }
}; };
...@@ -131,7 +143,7 @@ definitions.taskDescription.properties.dependsOn = dependsOn; ...@@ -131,7 +143,7 @@ definitions.taskDescription.properties.dependsOn = dependsOn;
// definitions.taskDescription.properties.isTestCommand.deprecationMessage = nls.localize('JsonSchema.tasks.isTestCommand.deprecated', 'The property isTestCommand is deprecated. Use the group property instead.'); // definitions.taskDescription.properties.isTestCommand.deprecationMessage = nls.localize('JsonSchema.tasks.isTestCommand.deprecated', 'The property isTestCommand is deprecated. Use the group property instead.');
definitions.taskDescription.properties.customize = customize; definitions.taskDescription.properties.customize = customize;
definitions.taskDescription.properties.type = Objects.deepClone(taskType); definitions.taskDescription.properties.type = Objects.deepClone(taskType);
definitions.taskDescription.properties.terminal = terminal; definitions.taskDescription.properties.presentation = presentation;
definitions.taskDescription.properties.group = group; definitions.taskDescription.properties.group = group;
definitions.options.properties.shell = { definitions.options.properties.shell = {
$ref: '#/definitions/shellConfiguration' $ref: '#/definitions/shellConfiguration'
......
...@@ -15,6 +15,7 @@ import * as Platform from 'vs/base/common/platform'; ...@@ -15,6 +15,7 @@ import * as Platform from 'vs/base/common/platform';
import * as Async from 'vs/base/common/async'; import * as Async from 'vs/base/common/async';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { IStringDictionary } from 'vs/base/common/collections'; import { IStringDictionary } from 'vs/base/common/collections';
import { LinkedMap, Touch } from 'vs/base/common/map';
import Severity from 'vs/base/common/severity'; import Severity from 'vs/base/common/severity';
import { EventEmitter } from 'vs/base/common/eventEmitter'; import { EventEmitter } from 'vs/base/common/eventEmitter';
import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IDisposable, dispose } from 'vs/base/common/lifecycle';
...@@ -33,7 +34,7 @@ import { IConfigurationResolverService } from 'vs/workbench/services/configurati ...@@ -33,7 +34,7 @@ import { IConfigurationResolverService } from 'vs/workbench/services/configurati
import { ITerminalService, ITerminalInstance, IShellLaunchConfig } from 'vs/workbench/parts/terminal/common/terminal'; import { ITerminalService, ITerminalInstance, IShellLaunchConfig } from 'vs/workbench/parts/terminal/common/terminal';
import { IOutputService, IOutputChannel } from 'vs/workbench/parts/output/common/output'; import { IOutputService, IOutputChannel } from 'vs/workbench/parts/output/common/output';
import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEvents } from 'vs/workbench/parts/tasks/common/problemCollectors'; import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEvents } from 'vs/workbench/parts/tasks/common/problemCollectors';
import { Task, RevealKind, CommandOptions, ShellConfiguration, CommandType } from 'vs/workbench/parts/tasks/common/tasks'; import { Task, RevealKind, CommandOptions, ShellConfiguration, CommandType, PanelKind } from 'vs/workbench/parts/tasks/common/tasks';
import { import {
ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver, ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver,
TelemetryEvent, Triggers, TaskSystemEvents, TaskEvent, TaskType TelemetryEvent, Triggers, TaskSystemEvents, TaskEvent, TaskType
...@@ -105,9 +106,9 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -105,9 +106,9 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
private outputChannel: IOutputChannel; private outputChannel: IOutputChannel;
private activeTasks: IStringDictionary<ActiveTerminalData>; private activeTasks: IStringDictionary<ActiveTerminalData>;
private primaryTerminal: PrimaryTerminal;
private terminals: IStringDictionary<TerminalData>; private terminals: IStringDictionary<TerminalData>;
private idleTaskTerminals: IStringDictionary<string>; private idleTaskTerminals: LinkedMap<string, string>;
private sameTaskTerminals: IStringDictionary<string>;
constructor(private terminalService: ITerminalService, private outputService: IOutputService, constructor(private terminalService: ITerminalService, private outputService: IOutputService,
private markerService: IMarkerService, private modelService: IModelService, private markerService: IMarkerService, private modelService: IModelService,
...@@ -120,7 +121,8 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -120,7 +121,8 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
this.outputChannel = this.outputService.getChannel(outputChannelId); this.outputChannel = this.outputService.getChannel(outputChannelId);
this.activeTasks = Object.create(null); this.activeTasks = Object.create(null);
this.terminals = Object.create(null); this.terminals = Object.create(null);
this.idleTaskTerminals = Object.create(null); this.idleTaskTerminals = new LinkedMap<string, string>();
this.sameTaskTerminals = Object.create(null);
} }
public log(value: string): void { public log(value: string): void {
...@@ -134,8 +136,8 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -134,8 +136,8 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
public run(task: Task, resolver: ITaskResolver, trigger: string = Triggers.command): ITaskExecuteResult { public run(task: Task, resolver: ITaskResolver, trigger: string = Triggers.command): ITaskExecuteResult {
let terminalData = this.activeTasks[task._id]; let terminalData = this.activeTasks[task._id];
if (terminalData && terminalData.promise) { if (terminalData && terminalData.promise) {
let reveal = task.command.terminalBehavior.reveal; let reveal = task.command.presentation.reveal;
let focus = task.command.terminalBehavior.focus; let focus = task.command.presentation.focus;
if (reveal === RevealKind.Always || focus) { if (reveal === RevealKind.Always || focus) {
this.terminalService.setActiveInstance(terminalData.terminal); this.terminalService.setActiveInstance(terminalData.terminal);
this.terminalService.showPanel(focus); this.terminalService.showPanel(focus);
...@@ -275,10 +277,14 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -275,10 +277,14 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
onData.dispose(); onData.dispose();
onExit.dispose(); onExit.dispose();
delete this.activeTasks[task._id]; delete this.activeTasks[task._id];
if (this.primaryTerminal && this.primaryTerminal.terminal === terminal) { switch (task.command.presentation.panel) {
this.primaryTerminal.busy = false; case PanelKind.Dedicated:
this.sameTaskTerminals[task._id] = terminal.id.toString();
break;
case PanelKind.Shared:
this.idleTaskTerminals.set(task._id, terminal.id.toString(), Touch.First);
break;
} }
this.idleTaskTerminals[task._id] = terminal.id.toString();
let remaining = decoder.end(); let remaining = decoder.end();
if (remaining) { if (remaining) {
watchingProblemMatcher.processLine(remaining); watchingProblemMatcher.processLine(remaining);
...@@ -291,7 +297,7 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -291,7 +297,7 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
this.emit(TaskSystemEvents.Inactive, event); this.emit(TaskSystemEvents.Inactive, event);
} }
eventCounter = 0; eventCounter = 0;
let reveal = task.command.terminalBehavior.reveal; let reveal = task.command.presentation.reveal;
if (exitCode && exitCode === 1 && watchingProblemMatcher.numberOfMatches === 0 && reveal !== RevealKind.Never) { if (exitCode && exitCode === 1 && watchingProblemMatcher.numberOfMatches === 0 && reveal !== RevealKind.Never) {
this.terminalService.setActiveInstance(terminal); this.terminalService.setActiveInstance(terminal);
this.terminalService.showPanel(false); this.terminalService.showPanel(false);
...@@ -317,10 +323,14 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -317,10 +323,14 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
onData.dispose(); onData.dispose();
onExit.dispose(); onExit.dispose();
delete this.activeTasks[task._id]; delete this.activeTasks[task._id];
if (this.primaryTerminal && this.primaryTerminal.terminal === terminal) { switch (task.command.presentation.panel) {
this.primaryTerminal.busy = false; case PanelKind.Dedicated:
this.sameTaskTerminals[task._id] = terminal.id.toString();
break;
case PanelKind.Shared:
this.idleTaskTerminals.set(task._id, terminal.id.toString(), Touch.First);
break;
} }
this.idleTaskTerminals[task._id] = terminal.id.toString();
let remaining = decoder.end(); let remaining = decoder.end();
if (remaining) { if (remaining) {
startStopProblemMatcher.processLine(remaining); startStopProblemMatcher.processLine(remaining);
...@@ -334,8 +344,8 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -334,8 +344,8 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
}); });
} }
this.terminalService.setActiveInstance(terminal); this.terminalService.setActiveInstance(terminal);
if (task.command.terminalBehavior.reveal === RevealKind.Always || (task.command.terminalBehavior.reveal === RevealKind.Silent && task.problemMatchers.length === 0)) { if (task.command.presentation.reveal === RevealKind.Always || (task.command.presentation.reveal === RevealKind.Silent && task.problemMatchers.length === 0)) {
this.terminalService.showPanel(task.command.terminalBehavior.focus); this.terminalService.showPanel(task.command.presentation.focus);
} }
this.activeTasks[task._id] = { terminal, task, promise }; this.activeTasks[task._id] = { terminal, task, promise };
return promise.then((summary) => { return promise.then((summary) => {
...@@ -371,7 +381,7 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -371,7 +381,7 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
let { command, args } = this.resolveCommandAndArgs(task); let { command, args } = this.resolveCommandAndArgs(task);
let terminalName = nls.localize('TerminalTaskSystem.terminalName', 'Task - {0}', task.name); let terminalName = nls.localize('TerminalTaskSystem.terminalName', 'Task - {0}', task.name);
let waitOnExit: boolean | string = false; let waitOnExit: boolean | string = false;
if (task.command.terminalBehavior.reveal !== RevealKind.Never || !task.isBackground) { if (task.command.presentation.reveal !== RevealKind.Never || !task.isBackground) {
waitOnExit = nls.localize('reuseTerminal', 'Terminal will be reused by tasks, press any key to close it.'); waitOnExit = nls.localize('reuseTerminal', 'Terminal will be reused by tasks, press any key to close it.');
}; };
let shellLaunchConfig: IShellLaunchConfig = undefined; let shellLaunchConfig: IShellLaunchConfig = undefined;
...@@ -424,7 +434,7 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -424,7 +434,7 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
}); });
shellArgs.push(commandLine); shellArgs.push(commandLine);
shellLaunchConfig.args = Platform.isWindows ? shellArgs.join(' ') : shellArgs; shellLaunchConfig.args = Platform.isWindows ? shellArgs.join(' ') : shellArgs;
if (task.command.terminalBehavior.echo) { if (task.command.presentation.echo) {
shellLaunchConfig.initialText = `\x1b[1m> Executing task: ${commandLine} <\x1b[0m\n`; shellLaunchConfig.initialText = `\x1b[1m> Executing task: ${commandLine} <\x1b[0m\n`;
} }
} else { } else {
...@@ -438,7 +448,7 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -438,7 +448,7 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
args, args,
waitOnExit waitOnExit
}; };
if (task.command.terminalBehavior.echo) { if (task.command.presentation.echo) {
let getArgsToEcho = (args: string | string[]): string => { let getArgsToEcho = (args: string | string[]): string => {
if (!args || args.length === 0) { if (!args || args.length === 0) {
return ''; return '';
...@@ -464,41 +474,38 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -464,41 +474,38 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
}); });
shellLaunchConfig.env = env; shellLaunchConfig.env = env;
} }
let terminalId = this.idleTaskTerminals[task._id]; let prefersSameTerminal = task.command.presentation.panel === PanelKind.Dedicated;
if (terminalId) { let allowsSharedTerminal = task.command.presentation.panel === PanelKind.Shared;
let taskTerminal = this.terminals[terminalId];
if (taskTerminal) { let terminalToReuse: TerminalData;
delete this.idleTaskTerminals[task._id]; if (prefersSameTerminal) {
taskTerminal.terminal.reuseTerminal(shellLaunchConfig); let terminalId = this.sameTaskTerminals[task._id];
return [taskTerminal.terminal, command]; if (terminalId) {
terminalToReuse = this.terminals[terminalId];
delete this.sameTaskTerminals[task._id];
} }
} } else if (allowsSharedTerminal) {
if (this.primaryTerminal && !this.primaryTerminal.busy) { let terminalId = this.idleTaskTerminals.remove(task._id) || this.idleTaskTerminals.shift();
// We reuse the primary terminal. Make sure the last running task isn't referenced in the idle terminals if (terminalId) {
let terminalData = this.terminals[this.primaryTerminal.terminal.id.toString()]; terminalToReuse = this.terminals[terminalId];
if (terminalData) {
delete this.idleTaskTerminals[terminalData.lastTask];
} }
this.primaryTerminal.terminal.reuseTerminal(shellLaunchConfig);
this.primaryTerminal.busy = true;
return [this.primaryTerminal.terminal, command];
} }
if (terminalToReuse) {
terminalToReuse.terminal.reuseTerminal(shellLaunchConfig);
return [terminalToReuse.terminal, command];
}
const result = this.terminalService.createInstance(shellLaunchConfig); const result = this.terminalService.createInstance(shellLaunchConfig);
const key = result.id.toString(); const key = result.id.toString();
result.onDisposed((terminal) => { result.onDisposed((terminal) => {
let terminalData = this.terminals[key]; let terminalData = this.terminals[key];
if (terminalData) { if (terminalData) {
delete this.terminals[key]; delete this.terminals[key];
delete this.idleTaskTerminals[terminalData.lastTask]; delete this.sameTaskTerminals[terminalData.lastTask];
} this.idleTaskTerminals.delete(terminalData.lastTask);
if (this.primaryTerminal && this.primaryTerminal.terminal === terminal) {
this.primaryTerminal = undefined;
} }
}); });
this.terminals[key] = { terminal: result, lastTask: task._id }; this.terminals[key] = { terminal: result, lastTask: task._id };
if (!task.isBackground && !this.primaryTerminal) {
this.primaryTerminal = { terminal: result, busy: true };
}
return [result, command]; return [result, command];
} }
......
...@@ -167,12 +167,12 @@ export class ProcessTaskSystem extends EventEmitter implements ITaskSystem { ...@@ -167,12 +167,12 @@ export class ProcessTaskSystem extends EventEmitter implements ITaskSystem {
this.childProcess = new LineProcess(command, args, commandConfig.type === CommandType.Shell, this.resolveOptions(commandConfig.options)); this.childProcess = new LineProcess(command, args, commandConfig.type === CommandType.Shell, this.resolveOptions(commandConfig.options));
telemetryEvent.command = this.childProcess.getSanitizedCommand(); telemetryEvent.command = this.childProcess.getSanitizedCommand();
// we have no problem matchers defined. So show the output log // we have no problem matchers defined. So show the output log
let reveal = task.command.terminalBehavior.reveal; let reveal = task.command.presentation.reveal;
if (reveal === RevealKind.Always || (reveal === RevealKind.Silent && task.problemMatchers.length === 0)) { if (reveal === RevealKind.Always || (reveal === RevealKind.Silent && task.problemMatchers.length === 0)) {
this.showOutput(); this.showOutput();
} }
if (commandConfig.terminalBehavior.echo) { if (commandConfig.presentation.echo) {
let prompt: string = Platform.isWindows ? '>' : '$'; let prompt: string = Platform.isWindows ? '>' : '$';
this.log(`running command${prompt} ${command} ${args.join(' ')}`); this.log(`running command${prompt} ${command} ${args.join(' ')}`);
} }
......
...@@ -77,31 +77,31 @@ class ConfiguationBuilder { ...@@ -77,31 +77,31 @@ class ConfiguationBuilder {
} }
} }
class TerminalBehaviorBuilder { class PresentationBuilder {
public result: Tasks.TerminalBehavior; public result: Tasks.PresentationOptions;
constructor(public parent: CommandConfigurationBuilder) { constructor(public parent: CommandConfigurationBuilder) {
this.result = { echo: false, reveal: Tasks.RevealKind.Always, focus: false, instance: Tasks.InstanceKind.Shared }; this.result = { echo: false, reveal: Tasks.RevealKind.Always, focus: false, panel: Tasks.PanelKind.Shared };
} }
public echo(value: boolean): TerminalBehaviorBuilder { public echo(value: boolean): PresentationBuilder {
this.result.echo = value; this.result.echo = value;
return this; return this;
} }
public reveal(value: Tasks.RevealKind): TerminalBehaviorBuilder { public reveal(value: Tasks.RevealKind): PresentationBuilder {
this.result.reveal = value; this.result.reveal = value;
return this; return this;
} }
public focus(value: boolean): TerminalBehaviorBuilder { public focus(value: boolean): PresentationBuilder {
this.result.focus = value; this.result.focus = value;
return this; return this;
} }
public instance(value: Tasks.InstanceKind): TerminalBehaviorBuilder { public instance(value: Tasks.PanelKind): PresentationBuilder {
this.result.instance = value; this.result.panel = value;
return this; return this;
} }
...@@ -112,10 +112,10 @@ class TerminalBehaviorBuilder { ...@@ -112,10 +112,10 @@ class TerminalBehaviorBuilder {
class CommandConfigurationBuilder { class CommandConfigurationBuilder {
public result: Tasks.CommandConfiguration; public result: Tasks.CommandConfiguration;
private terminalBuilder: TerminalBehaviorBuilder; private presentationBuilder: PresentationBuilder;
constructor(public parent: TaskBuilder, command: string) { constructor(public parent: TaskBuilder, command: string) {
this.terminalBuilder = new TerminalBehaviorBuilder(this); this.presentationBuilder = new PresentationBuilder(this);
this.result = { this.result = {
name: command, name: command,
type: Tasks.CommandType.Process, type: Tasks.CommandType.Process,
...@@ -123,7 +123,7 @@ class CommandConfigurationBuilder { ...@@ -123,7 +123,7 @@ class CommandConfigurationBuilder {
options: { options: {
cwd: '${workspaceRoot}' cwd: '${workspaceRoot}'
}, },
terminalBehavior: this.terminalBuilder.result, presentation: this.presentationBuilder.result,
suppressTaskName: false suppressTaskName: false
}; };
} }
...@@ -158,13 +158,13 @@ class CommandConfigurationBuilder { ...@@ -158,13 +158,13 @@ class CommandConfigurationBuilder {
return this; return this;
} }
public terminal(): TerminalBehaviorBuilder { public presentation(): PresentationBuilder {
return this.terminalBuilder; return this.presentationBuilder;
} }
public done(taskName: string): void { public done(taskName: string): void {
this.result.args = this.result.args.map(arg => arg === '$name' ? taskName : arg); this.result.args = this.result.args.map(arg => arg === '$name' ? taskName : arg);
this.terminalBuilder.done(); this.presentationBuilder.done();
} }
} }
...@@ -458,7 +458,7 @@ function assertTask(actual: Tasks.Task, expected: Tasks.Task) { ...@@ -458,7 +458,7 @@ function assertTask(actual: Tasks.Task, expected: Tasks.Task) {
function assertCommandConfiguration(actual: Tasks.CommandConfiguration, expected: Tasks.CommandConfiguration) { function assertCommandConfiguration(actual: Tasks.CommandConfiguration, expected: Tasks.CommandConfiguration) {
assert.strictEqual(typeof actual, typeof expected); assert.strictEqual(typeof actual, typeof expected);
if (actual && expected) { if (actual && expected) {
assertTerminalBehavior(actual.terminalBehavior, expected.terminalBehavior); assertPresentation(actual.presentation, expected.presentation);
assert.strictEqual(actual.name, expected.name, 'name'); assert.strictEqual(actual.name, expected.name, 'name');
assert.strictEqual(actual.type, expected.type, 'task type'); assert.strictEqual(actual.type, expected.type, 'task type');
assert.strictEqual(actual.suppressTaskName, expected.suppressTaskName, 'suppressTaskName'); assert.strictEqual(actual.suppressTaskName, expected.suppressTaskName, 'suppressTaskName');
...@@ -475,7 +475,7 @@ function assertCommandConfiguration(actual: Tasks.CommandConfiguration, expected ...@@ -475,7 +475,7 @@ function assertCommandConfiguration(actual: Tasks.CommandConfiguration, expected
} }
} }
function assertTerminalBehavior(actual: Tasks.TerminalBehavior, expected: Tasks.TerminalBehavior) { function assertPresentation(actual: Tasks.PresentationOptions, expected: Tasks.PresentationOptions) {
assert.strictEqual(typeof actual, typeof expected); assert.strictEqual(typeof actual, typeof expected);
if (actual && expected) { if (actual && expected) {
assert.strictEqual(actual.echo, expected.echo); assert.strictEqual(actual.echo, expected.echo);
...@@ -574,7 +574,7 @@ suite('Tasks version 0.1.0', () => { ...@@ -574,7 +574,7 @@ suite('Tasks version 0.1.0', () => {
task('tsc', 'tsc'). task('tsc', 'tsc').
group(Tasks.TaskGroup.Build). group(Tasks.TaskGroup.Build).
command().suppressTaskName(true). command().suppressTaskName(true).
terminal().reveal(Tasks.RevealKind.Silent); presentation().reveal(Tasks.RevealKind.Silent);
testConfiguration( testConfiguration(
{ {
version: '0.1.0', version: '0.1.0',
...@@ -639,7 +639,7 @@ suite('Tasks version 0.1.0', () => { ...@@ -639,7 +639,7 @@ suite('Tasks version 0.1.0', () => {
task('tsc', 'tsc'). task('tsc', 'tsc').
group(Tasks.TaskGroup.Build). group(Tasks.TaskGroup.Build).
command().suppressTaskName(true). command().suppressTaskName(true).
terminal().reveal(Tasks.RevealKind.Never); presentation().reveal(Tasks.RevealKind.Never);
testConfiguration( testConfiguration(
{ {
version: '0.1.0', version: '0.1.0',
...@@ -656,7 +656,7 @@ suite('Tasks version 0.1.0', () => { ...@@ -656,7 +656,7 @@ suite('Tasks version 0.1.0', () => {
task('tsc', 'tsc'). task('tsc', 'tsc').
group(Tasks.TaskGroup.Build). group(Tasks.TaskGroup.Build).
command().suppressTaskName(true). command().suppressTaskName(true).
terminal(). presentation().
echo(true); echo(true);
testConfiguration( testConfiguration(
{ {
...@@ -805,7 +805,7 @@ suite('Tasks version 0.1.0', () => { ...@@ -805,7 +805,7 @@ suite('Tasks version 0.1.0', () => {
task('tsc', 'tsc'). task('tsc', 'tsc').
group(Tasks.TaskGroup.Build). group(Tasks.TaskGroup.Build).
command().suppressTaskName(true). command().suppressTaskName(true).
terminal().reveal(Platform.isWindows ? Tasks.RevealKind.Always : Tasks.RevealKind.Never); presentation().reveal(Platform.isWindows ? Tasks.RevealKind.Always : Tasks.RevealKind.Never);
let external: ExternalTaskRunnerConfiguration = { let external: ExternalTaskRunnerConfiguration = {
version: '0.1.0', version: '0.1.0',
command: 'tsc', command: 'tsc',
...@@ -823,7 +823,7 @@ suite('Tasks version 0.1.0', () => { ...@@ -823,7 +823,7 @@ suite('Tasks version 0.1.0', () => {
task('tsc', 'tsc'). task('tsc', 'tsc').
group(Tasks.TaskGroup.Build). group(Tasks.TaskGroup.Build).
command().suppressTaskName(true). command().suppressTaskName(true).
terminal(). presentation().
echo(Platform.isWindows ? false : true); echo(Platform.isWindows ? false : true);
let external: ExternalTaskRunnerConfiguration = { let external: ExternalTaskRunnerConfiguration = {
version: '0.1.0', version: '0.1.0',
...@@ -951,7 +951,7 @@ suite('Tasks version 0.1.0', () => { ...@@ -951,7 +951,7 @@ suite('Tasks version 0.1.0', () => {
isBackground(true). isBackground(true).
promptOnClose(false). promptOnClose(false).
command().args(['$name', '--p']). command().args(['$name', '--p']).
terminal(). presentation().
echo(true).reveal(Tasks.RevealKind.Never); echo(true).reveal(Tasks.RevealKind.Never);
testConfiguration(external, builder); testConfiguration(external, builder);
...@@ -972,7 +972,7 @@ suite('Tasks version 0.1.0', () => { ...@@ -972,7 +972,7 @@ suite('Tasks version 0.1.0', () => {
let builder = new ConfiguationBuilder(); let builder = new ConfiguationBuilder();
builder.task('test', 'tsc'). builder.task('test', 'tsc').
group(Tasks.TaskGroup.Test). group(Tasks.TaskGroup.Test).
command().args(['$name']).terminal(). command().args(['$name']).presentation().
echo(true).reveal(Tasks.RevealKind.Never); echo(true).reveal(Tasks.RevealKind.Never);
testConfiguration(external, builder); testConfiguration(external, builder);
...@@ -1457,7 +1457,7 @@ suite('Tasks version 2.0.0', () => { ...@@ -1457,7 +1457,7 @@ suite('Tasks version 2.0.0', () => {
group(Tasks.TaskGroup.Build). group(Tasks.TaskGroup.Build).
command().suppressTaskName(true). command().suppressTaskName(true).
type(Tasks.CommandType.Shell). type(Tasks.CommandType.Shell).
terminal().echo(true); presentation().echo(true);
testConfiguration(external, builder); testConfiguration(external, builder);
}); });
...@@ -1518,14 +1518,14 @@ suite('Bugs / regression tests', () => { ...@@ -1518,14 +1518,14 @@ suite('Bugs / regression tests', () => {
command().suppressTaskName(true). command().suppressTaskName(true).
args(['-ExecutionPolicy', 'RemoteSigned', '.\\dockerTask.ps1', '-ComposeForDebug', '-Environment', 'debug']). args(['-ExecutionPolicy', 'RemoteSigned', '.\\dockerTask.ps1', '-ComposeForDebug', '-Environment', 'debug']).
options({ cwd: '${workspaceRoot}' }). options({ cwd: '${workspaceRoot}' }).
terminal().echo(true).reveal(Tasks.RevealKind.Always); presentation().echo(true).reveal(Tasks.RevealKind.Always);
testConfiguration(external, builder); testConfiguration(external, builder);
} else if (Platform.isMacintosh) { } else if (Platform.isMacintosh) {
builder.task('composeForDebug', '/bin/bash'). builder.task('composeForDebug', '/bin/bash').
command().suppressTaskName(true). command().suppressTaskName(true).
args(['-c', './dockerTask.sh composeForDebug debug']). args(['-c', './dockerTask.sh composeForDebug debug']).
options({ cwd: '${workspaceRoot}' }). options({ cwd: '${workspaceRoot}' }).
terminal().reveal(Tasks.RevealKind.Always); presentation().reveal(Tasks.RevealKind.Always);
testConfiguration(external, builder); testConfiguration(external, builder);
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册