diff --git a/src/vs/workbench/browser/parts/compositeBar.ts b/src/vs/workbench/browser/parts/compositeBar.ts index 31749fb69ce08e702396a2e56aaab71dda638e30..f556b19bcbf5bf20a0999c9906453108918cb885 100644 --- a/src/vs/workbench/browser/parts/compositeBar.ts +++ b/src/vs/workbench/browser/parts/compositeBar.ts @@ -143,6 +143,7 @@ export class CompositeBar extends Widget implements ICompositeBar { hideComposite(id: string): void { if (this.model.hide(id)) { this.updateCompositeSwitcher(); + this.resetActiveComposite(id); } } @@ -196,34 +197,38 @@ export class CompositeBar extends Widget implements ICompositeBar { this.updateCompositeSwitcher(); - const defaultCompositeId = this.options.getDefaultCompositeId(); + this.resetActiveComposite(compositeId); + } + } - // Case: composite is not the active one or the active one is a different one - // Solv: we do nothing - if (!this.model.activeItem || this.model.activeItem.id !== compositeId) { - return; - } + private resetActiveComposite(compositeId: string) { + const defaultCompositeId = this.options.getDefaultCompositeId(); - // Deactivate itself - this.deactivateComposite(compositeId); + // Case: composite is not the active one or the active one is a different one + // Solv: we do nothing + if (!this.model.activeItem || this.model.activeItem.id !== compositeId) { + return; + } - // Case: composite is not the default composite and default composite is still showing - // Solv: we open the default composite - if (defaultCompositeId !== compositeId && this.isPinned(defaultCompositeId)) { - this.options.openComposite(defaultCompositeId); - } + // Deactivate itself + this.deactivateComposite(compositeId); - // Case: we closed the last visible composite - // Solv: we hide the part - else if (this.visibleComposites.length === 1) { - this.options.hidePart(); - } + // Case: composite is not the default composite and default composite is still showing + // Solv: we open the default composite + if (defaultCompositeId !== compositeId && this.isPinned(defaultCompositeId)) { + this.options.openComposite(defaultCompositeId); + } - // Case: we closed the default composite - // Solv: we open the next visible composite from top - else { - this.options.openComposite(this.visibleComposites.filter(cid => cid !== compositeId)[0]); - } + // Case: we closed the last visible composite + // Solv: we hide the part + else if (this.visibleComposites.length === 1) { + this.options.hidePart(); + } + + // Case: we closed the default composite + // Solv: we open the next visible composite from top + else { + this.options.openComposite(this.visibleComposites.filter(cid => cid !== compositeId)[0]); } }