Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use app shell methods for expand / collapse for toggle terminal command #13131

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 4 additions & 8 deletions packages/terminal/src/browser/terminal-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,28 +637,24 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu
}

protected toggleTerminal(): void {

const terminals = this.shell.getWidgets('bottom').filter(w => w instanceof TerminalWidget);

if (terminals.length === 0) {
this.openTerminal();
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');
}
}

Expand Down
Loading