From 452ec93c6fdaae99c249f179956dc0edf29bd34c Mon Sep 17 00:00:00 2001 From: Remi Schnekenburger Date: Wed, 19 Jul 2023 17:14:23 +0200 Subject: [PATCH] fix comments from PR --- CHANGELOG.md | 1 + .../src/browser/task-terminal-widget-manager.ts | 15 +++++++-------- packages/task/src/common/task-protocol.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 665dc4ceedc62..88f0d776eb40c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Show command shortcuts in toolbar item tooltips. #12660 (https://github.com/eclipse-theia/theia/pull/12660) - Contributed on behalf of STMicroelectronics - [cli] added `check:theia-extensions` which checks the uniqueness of Theia extension versions [#12596](https://github.com/eclipse-theia/theia/pull/12596) - Contributed on behalf of STMicroelectronics +- [vscode] Add support for the TaskPresentationOptions close property []() [Breaking Changes:](#breaking_changes_1.40.0) diff --git a/packages/task/src/browser/task-terminal-widget-manager.ts b/packages/task/src/browser/task-terminal-widget-manager.ts index ae5bc8a1185e8..01be5628aab92 100644 --- a/packages/task/src/browser/task-terminal-widget-manager.ts +++ b/packages/task/src/browser/task-terminal-widget-manager.ts @@ -94,7 +94,7 @@ export class TaskTerminalWidgetManager { if (terminal.taskId === finishedTaskId) { const showReuseMessage = !!event.config && TaskOutputPresentation.shouldShowReuseMessage(event.config); const closeOnFinish = !!event.config && TaskOutputPresentation.shouldCloseTerminalOnFinish(event.config); - this.notifyTaskFinished(terminal, showReuseMessage, closeOnFinish); + this.updateTerminalOnTaskExit(terminal, showReuseMessage, closeOnFinish); break; } } @@ -114,11 +114,11 @@ export class TaskTerminalWidgetManager { terminal.taskConfig = taskConfig; terminal.busy = true; } else { - this.notifyTaskFinished(terminal, true, false); + this.updateTerminalOnTaskExit(terminal, true, false); } }); const didConnectFailureListener = terminal.onDidOpenFailure(async () => { - this.notifyTaskFinished(terminal, true, false); + this.updateTerminalOnTaskExit(terminal, true, false); }); terminal.onDidDispose(() => { didConnectListener.dispose(); @@ -212,14 +212,13 @@ export class TaskTerminalWidgetManager { return this.terminalService.all.filter(TaskTerminalWidget.is); } - protected notifyTaskFinished(terminal: TaskTerminalWidget, showReuseMessage: boolean, closeOnFinish: boolean): void { + protected updateTerminalOnTaskExit(terminal: TaskTerminalWidget, showReuseMessage: boolean, closeOnFinish: boolean): void { terminal.busy = false; - terminal.scrollToBottom(); - if (showReuseMessage) { - terminal.writeLine('\x1b[1m\n\rTerminal will be reused by tasks. \x1b[0m\n'); - } if (closeOnFinish) { terminal.close(); + } else if (showReuseMessage) { + terminal.scrollToBottom(); + terminal.writeLine('\x1b[1m\n\rTerminal will be reused by tasks. \x1b[0m\n'); } } } diff --git a/packages/task/src/common/task-protocol.ts b/packages/task/src/common/task-protocol.ts index 816412e2cf77d..3e32f3d7b4d1c 100644 --- a/packages/task/src/common/task-protocol.ts +++ b/packages/task/src/common/task-protocol.ts @@ -112,7 +112,7 @@ export namespace TaskOutputPresentation { } export function shouldCloseTerminalOnFinish(task: TaskCustomization): boolean { - return !task.presentation || task.presentation.close === undefined || !!task.presentation.close; + return !!task.presentation && !!task.presentation.close; } export function shouldShowReuseMessage(task: TaskCustomization): boolean {