未验证 提交 f3966afc 编写于 作者: D Dirk Bäumer 提交者: GitHub

Merge pull request #44461 from oriash93/oriash93/42993

Added option whether to show terminal reuse alert
......@@ -4430,6 +4430,11 @@ declare module 'vscode' {
* every task execution (new). Defaults to `TaskInstanceKind.Shared`
*/
panel?: TaskPanelKind;
/**
* Controls whether to show the "Terminal will be reused by tasks, press any key to close it" message.
*/
reuseMessage?: boolean;
}
/**
......
......@@ -232,13 +232,14 @@ namespace TaskPanelKind {
namespace PresentationOptions {
export function from(value: vscode.TaskPresentationOptions): tasks.PresentationOptions {
if (value === void 0 || value === null) {
return { reveal: tasks.RevealKind.Always, echo: true, focus: false, panel: tasks.PanelKind.Shared };
return { reveal: tasks.RevealKind.Always, echo: true, focus: false, panel: tasks.PanelKind.Shared, reuseMessage: true };
}
return {
reveal: TaskRevealKind.from(value.reveal),
echo: value.echo === void 0 ? true : !!value.echo,
focus: !!value.focus,
panel: TaskPanelKind.from(value.panel)
panel: TaskPanelKind.from(value.panel),
reuseMessage: value.reuseMessage === void 0 ? true : !!value.reuseMessage
};
}
}
......
......@@ -196,6 +196,11 @@ export interface PresentationOptions {
* every task execution (new). Defaults to `TaskInstanceKind.Shared`
*/
panel: PanelKind;
/**
* Controls whether to show the "Terminal will be reused by tasks, press any key to close it" message.
*/
reuseMessage: boolean;
}
export enum RuntimeType {
......
......@@ -82,7 +82,8 @@ const presentation: IJSONSchema = {
echo: true,
reveal: 'always',
focus: false,
panel: 'shared'
panel: 'shared',
reuseMessage: true
},
description: nls.localize('JsonSchema.tasks.presentation', 'Configures the panel that is used to present the task\'s ouput and reads its input.'),
additionalProperties: false,
......@@ -113,6 +114,11 @@ const presentation: IJSONSchema = {
enum: ['shared', 'dedicated', 'new'],
default: 'shared',
description: nls.localize('JsonSchema.tasks.presentation.instance', 'Controls if the panel is shared between tasks, dedicated to this task or a new one is created on every run.')
},
reuseMessage: {
type: 'boolean',
default: true,
description: nls.localize('JsonSchema.tasks.presentation.reuseMessage', 'Controls whether to show the `Terminal will be reused by tasks, press any key to close it` message.')
}
}
};
......
......@@ -527,7 +527,7 @@ export class TerminalTaskSystem implements ITaskSystem {
if (task.command.presentation.reveal !== RevealKind.Never || !task.isBackground) {
if (task.command.presentation.panel === PanelKind.New) {
waitOnExit = nls.localize('closeTerminal', 'Press any key to close the terminal.');
} else {
} else if (task.command.presentation.reuseMessage) {
waitOnExit = nls.localize('reuseTerminal', 'Terminal will be reused by tasks, press any key to close it.');
}
}
......
......@@ -108,6 +108,11 @@ export interface PresentationOptions {
* Controls whether the task runs in a new terminal
*/
panel?: string;
/**
* Controls whether to show the "Terminal will be reused by tasks, press any key to close it" message.
*/
reuseMessage: boolean;
}
export interface TaskIdentifier {
......@@ -735,7 +740,7 @@ namespace CommandOptions {
namespace CommandConfiguration {
export namespace PresentationOptions {
const properties: MetaData<Tasks.PresentationOptions, void>[] = [{ property: 'echo' }, { property: 'reveal' }, { property: 'focus' }, { property: 'panel' }];
const properties: MetaData<Tasks.PresentationOptions, void>[] = [{ property: 'echo' }, { property: 'reveal' }, { property: 'focus' }, { property: 'panel' }, { property: 'reuseMessage' }];
interface PresentationOptionsShape extends LegacyCommandProperties {
presentation?: PresentationOptions;
......@@ -746,6 +751,7 @@ namespace CommandConfiguration {
let reveal: Tasks.RevealKind;
let focus: boolean;
let panel: Tasks.PanelKind;
let reuseMessage: boolean;
if (Types.isBoolean(config.echoCommand)) {
echo = config.echoCommand;
}
......@@ -766,11 +772,14 @@ namespace CommandConfiguration {
if (Types.isString(presentation.panel)) {
panel = Tasks.PanelKind.fromString(presentation.panel);
}
if (Types.isBoolean(presentation.reuseMessage)) {
reuseMessage = presentation.reuseMessage;
}
}
if (echo === void 0 && reveal === void 0 && focus === void 0 && panel === void 0) {
if (echo === void 0 && reveal === void 0 && focus === void 0 && panel === void 0 && reuseMessage === void 0) {
return undefined;
}
return { echo, reveal, focus, panel };
return { echo, reveal, focus, panel, reuseMessage };
}
export function assignProperties(target: Tasks.PresentationOptions, source: Tasks.PresentationOptions): Tasks.PresentationOptions {
......@@ -783,7 +792,7 @@ namespace CommandConfiguration {
export function fillDefaults(value: Tasks.PresentationOptions, context: ParseContext): Tasks.PresentationOptions {
let defaultEcho = context.engine === Tasks.ExecutionEngine.Terminal ? true : false;
return _fillDefaults(value, { echo: defaultEcho, reveal: Tasks.RevealKind.Always, focus: false, panel: Tasks.PanelKind.Shared }, properties, context);
return _fillDefaults(value, { echo: defaultEcho, reveal: Tasks.RevealKind.Always, focus: false, panel: Tasks.PanelKind.Shared, reuseMessage: true }, properties, context);
}
export function freeze(value: Tasks.PresentationOptions): Readonly<Tasks.PresentationOptions> {
......
......@@ -85,7 +85,7 @@ class PresentationBuilder {
public result: Tasks.PresentationOptions;
constructor(public parent: CommandConfigurationBuilder) {
this.result = { echo: false, reveal: Tasks.RevealKind.Always, focus: false, panel: Tasks.PanelKind.Shared };
this.result = { echo: false, reveal: Tasks.RevealKind.Always, focus: false, panel: Tasks.PanelKind.Shared, reuseMessage: true };
}
public echo(value: boolean): PresentationBuilder {
......@@ -108,6 +108,11 @@ class PresentationBuilder {
return this;
}
public reuseMessage(value: boolean): PresentationBuilder {
this.result.reuseMessage = value;
return this;
}
public done(): void {
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册