@@ -1565,16 +1565,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
1565
1565
this . workbenchGrid = workbenchGrid ;
1566
1566
this . workbenchGrid . edgeSnapping = this . state . runtime . mainWindowFullscreen ;
1567
1567
1568
- if ( this . stateModel . getRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_WAS_LAST_MAXIMIZED ) ) {
1569
- // TODO@benibenj this is a workaround for the grid not being able to
1570
- // restore the maximized auxiliary bar on startup when it was maximised
1571
- // It seems that since editor and panel are hidden, the parent node is
1572
- // also hidden and not present, breaking the layout.
1573
- // Workaround is to make editor visible so that its parent view gets
1574
- // added properly and then enter maximized mode of auxiliary bar.
1575
- this . setAuxiliaryBarMaximized ( true , true /* fromInit */ ) ;
1576
- }
1577
-
1578
1568
for ( const part of [ titleBar , editorPart , activityBar , panelPart , sideBar , statusBar , auxiliaryBarPart , bannerPart ] ) {
1579
1569
this . _register ( part . onDidVisibilityChange ( visible => {
1580
1570
if ( ! this . inMaximizedAuxiliaryBarTransition ) {
@@ -2023,63 +2013,42 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2023
2013
}
2024
2014
}
2025
2015
2026
- private maximizedAuxiliaryBarState : {
2027
- sideBarVisible : boolean ;
2028
- editorVisible : boolean ;
2029
- panelVisible : boolean ;
2030
- auxiliaryBarVisible : boolean ;
2031
- } | undefined = undefined ;
2032
-
2033
2016
private inMaximizedAuxiliaryBarTransition = false ;
2034
2017
2035
2018
isAuxiliaryBarMaximized ( ) : boolean {
2036
- return ! ! this . maximizedAuxiliaryBarState ;
2019
+ return this . stateModel . getRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_WAS_LAST_MAXIMIZED ) ;
2037
2020
}
2038
2021
2039
2022
toggleMaximizedAuxiliaryBar ( ) : void {
2040
2023
this . setAuxiliaryBarMaximized ( ! this . isAuxiliaryBarMaximized ( ) ) ;
2041
2024
}
2042
2025
2043
- setAuxiliaryBarMaximized ( maximized : boolean , fromInit ?: boolean ) : boolean {
2026
+ setAuxiliaryBarMaximized ( maximized : boolean ) : boolean {
2044
2027
if (
2045
- this . inMaximizedAuxiliaryBarTransition || // prevent re-entrance
2046
- ( ! maximized && ! this . maximizedAuxiliaryBarState ) // return early if not maximizing and no state
2028
+ this . inMaximizedAuxiliaryBarTransition || // prevent re-entrance
2029
+ ( maximized === this . isAuxiliaryBarMaximized ( ) ) // return early if state is already present
2047
2030
) {
2048
2031
return false ;
2049
2032
}
2050
2033
2051
2034
if ( maximized ) {
2052
- let state : typeof this . maximizedAuxiliaryBarState ;
2053
- if ( fromInit ) {
2054
-
2055
- // TODO workaround for a bug with grid, see above in `createWorkbenchLayout`
2056
- const stateMixin = { editorVisible : true } ;
2057
- this . setEditorHidden ( false ) ;
2058
- // TODO workaround
2059
-
2060
- state = {
2061
- ...this . stateModel . getRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY ) ,
2062
- ...stateMixin
2063
- } ;
2064
- } else {
2065
- state = {
2066
- sideBarVisible : this . isVisible ( Parts . SIDEBAR_PART ) ,
2067
- editorVisible : this . isVisible ( Parts . EDITOR_PART ) ,
2068
- panelVisible : this . isVisible ( Parts . PANEL_PART ) ,
2069
- auxiliaryBarVisible : this . isVisible ( Parts . AUXILIARYBAR_PART )
2070
- } ;
2071
- }
2072
- this . maximizedAuxiliaryBarState = state ;
2035
+ const state = {
2036
+ sideBarVisible : this . isVisible ( Parts . SIDEBAR_PART ) ,
2037
+ editorVisible : this . isVisible ( Parts . EDITOR_PART ) ,
2038
+ panelVisible : this . isVisible ( Parts . PANEL_PART ) ,
2039
+ auxiliaryBarVisible : this . isVisible ( Parts . AUXILIARYBAR_PART )
2040
+ } ;
2041
+ this . stateModel . setRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_WAS_LAST_MAXIMIZED , true ) ;
2073
2042
2074
2043
this . inMaximizedAuxiliaryBarTransition = true ;
2075
2044
try {
2076
2045
if ( ! state . auxiliaryBarVisible ) {
2077
2046
this . setAuxiliaryBarHidden ( false ) ;
2078
2047
}
2079
- if ( ! fromInit ) {
2080
- const size = this . workbenchGrid . getViewSize ( this . auxiliaryBarPartView ) . width ;
2081
- this . stateModel . setRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE , size ) ;
2082
- }
2048
+
2049
+ const size = this . workbenchGrid . getViewSize ( this . auxiliaryBarPartView ) . width ;
2050
+ this . stateModel . setRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE , size ) ;
2051
+
2083
2052
if ( state . sideBarVisible ) {
2084
2053
this . setSideBarHidden ( true ) ;
2085
2054
}
@@ -2090,15 +2059,13 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2090
2059
this . setEditorHidden ( true ) ;
2091
2060
}
2092
2061
2093
- if ( ! fromInit ) {
2094
- this . stateModel . setRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY , state ) ;
2095
- }
2062
+ this . stateModel . setRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY , state ) ;
2096
2063
} finally {
2097
2064
this . inMaximizedAuxiliaryBarTransition = false ;
2098
2065
}
2099
2066
} else {
2100
- const state = assertReturnsDefined ( this . maximizedAuxiliaryBarState ) ;
2101
- this . maximizedAuxiliaryBarState = undefined ;
2067
+ const state = assertReturnsDefined ( this . stateModel . getRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY ) ) ;
2068
+ this . stateModel . setRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_WAS_LAST_MAXIMIZED , false ) ;
2102
2069
2103
2070
this . inMaximizedAuxiliaryBarTransition = true ;
2104
2071
try {
@@ -2118,8 +2085,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2118
2085
2119
2086
this . focusPart ( Parts . AUXILIARYBAR_PART ) ;
2120
2087
2121
- this . stateModel . setRuntimeValue ( LayoutStateKeys . AUXILIARYBAR_WAS_LAST_MAXIMIZED , maximized ) ;
2122
-
2123
2088
this . _onDidChangeAuxiliaryBarMaximized . fire ( ) ;
2124
2089
2125
2090
return true ;
@@ -2451,7 +2416,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2451
2416
return {
2452
2417
type : 'branch' ,
2453
2418
data : result ,
2454
- size : availableHeight
2419
+ size : availableHeight ,
2420
+ visible : result . some ( node => node . visible )
2455
2421
} ;
2456
2422
}
2457
2423
@@ -2496,10 +2462,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2496
2462
auxiliaryBar : auxiliaryBarNextToEditor ? nodes . auxiliaryBar : undefined
2497
2463
} , availableHeight - panelSize , editorSectionWidth ) ;
2498
2464
2465
+ const data = panelPostion === Position . BOTTOM ? [ editorNodes , nodes . panel ] : [ nodes . panel , editorNodes ] ;
2499
2466
result . push ( {
2500
2467
type : 'branch' ,
2501
- data : panelPostion === Position . BOTTOM ? [ editorNodes , nodes . panel ] : [ nodes . panel , editorNodes ] ,
2502
- size : editorSectionWidth
2468
+ data,
2469
+ size : editorSectionWidth ,
2470
+ visible : data . some ( node => node . visible )
2503
2471
} ) ;
2504
2472
2505
2473
if ( ! sideBarNextToEditor ) {
0 commit comments