Skip to content

Commit

Permalink
fix comments from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
rschnekenbu committed Jul 20, 2023
1 parent acbba01 commit 452ec93
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 []()

<a name="breaking_changes_1.40.0">[Breaking Changes:](#breaking_changes_1.40.0)</a>

Expand Down
15 changes: 7 additions & 8 deletions packages/task/src/browser/task-terminal-widget-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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();
Expand Down Expand Up @@ -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');
}
}
}
2 changes: 1 addition & 1 deletion packages/task/src/common/task-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 452ec93

Please sign in to comment.