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 all 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

- [Previous Changelogs](https://github.com/eclipse-theia/theia/tree/master/doc/changelogs/)

## Unreleased
- [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.44.0 - 11/30/2023

- [application-manager] added option to copy `trash` dependency to the bundle [#13112](https://github.com/eclipse-theia/theia/pull/13112)
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