From 27d54acce7482169d0a19bca985acd0e5f9d43f3 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Thu, 30 Nov 2023 12:59:02 -0500 Subject: [PATCH 1/3] Use app shell methods for expand / collapse Signed-off-by: Bryan Chen --- .../src/browser/terminal-frontend-contribution.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/terminal/src/browser/terminal-frontend-contribution.ts b/packages/terminal/src/browser/terminal-frontend-contribution.ts index 2263f1402e692..76bf6def3c828 100644 --- a/packages/terminal/src/browser/terminal-frontend-contribution.ts +++ b/packages/terminal/src/browser/terminal-frontend-contribution.ts @@ -637,7 +637,6 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu } protected toggleTerminal(): void { - const terminals = this.shell.getWidgets('bottom').filter(w => w instanceof TerminalWidget); if (terminals.length === 0) { @@ -645,20 +644,17 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu return; } - if (this.shell.bottomPanel.isHidden) { - this.shell.bottomPanel.setHidden(false); + if (!this.shell.isExpanded("bottom")) { + this.shell.expandPanel("bottom"); terminals[0].activate(); - return; - } - - if (this.shell.bottomPanel.isVisible) { + } else { const visibleTerminal = terminals.find(t => t.isVisible); if (!visibleTerminal) { this.shell.bottomPanel.activateWidget(terminals[0]); } else if (this.shell.activeWidget !== visibleTerminal) { this.shell.bottomPanel.activateWidget(visibleTerminal); } else { - this.shell.bottomPanel.setHidden(true); + this.shell.collapsePanel("bottom"); } } From b080e44aa7b828b4ab55793a14f35cfde0762b40 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Thu, 30 Nov 2023 13:04:44 -0500 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2d7c89444bc7..4b51d93ed3f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - [vscode] added support for editor.indentSize API [#13105](https://github.com/eclipse-theia/theia/pull/13105) - contributed on behalf of STMicroelectronics - [vscode] added support to env.ondidChangeShell event [#13097](https://github.com/eclipse-theia/theia/pull/13097) - contributed on behalf of STMicroelectronics - [task] support `isDefault: false` in task group definition [#13075](https://github.com/eclipse-theia/theia/pull/13075) - contributed on behalf of STMicroelectronics +- [terminal] Use application shell methods for expanding/collapsing bottom panel for "Terminal: Toggle Terminal" command [#13131](https://github.com/eclipse-theia/theia/pull/13131) ## v1.43.0 - 10/26/2023 From 2fcc8219030494223c3192828dbefb15cce4cc02 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Thu, 30 Nov 2023 14:20:39 -0500 Subject: [PATCH 3/3] Fix lints --- .../terminal/src/browser/terminal-frontend-contribution.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/terminal/src/browser/terminal-frontend-contribution.ts b/packages/terminal/src/browser/terminal-frontend-contribution.ts index 76bf6def3c828..0602a6ca5f078 100644 --- a/packages/terminal/src/browser/terminal-frontend-contribution.ts +++ b/packages/terminal/src/browser/terminal-frontend-contribution.ts @@ -644,8 +644,8 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu return; } - if (!this.shell.isExpanded("bottom")) { - this.shell.expandPanel("bottom"); + if (!this.shell.isExpanded('bottom')) { + this.shell.expandPanel('bottom'); terminals[0].activate(); } else { const visibleTerminal = terminals.find(t => t.isVisible); @@ -654,7 +654,7 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu } else if (this.shell.activeWidget !== visibleTerminal) { this.shell.bottomPanel.activateWidget(visibleTerminal); } else { - this.shell.collapsePanel("bottom"); + this.shell.collapsePanel('bottom'); } }