@@ -628,7 +628,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
628628 private initLayoutState ( lifecycleService : ILifecycleService , fileService : IFileService ) : void {
629629 this . _mainContainerDimension = getClientArea ( this . parent , DEFAULT_WINDOW_DIMENSIONS ) ; // running with fallback to ensure no error is thrown (https://github.com/microsoft/vscode/issues/240242)
630630
631- this . stateModel = new LayoutStateModel ( this . storageService , this . configurationService , this . contextService , this . environmentService , this . viewDescriptorService ) ;
631+ this . stateModel = new LayoutStateModel ( this . storageService , this . configurationService , this . contextService ) ;
632632 this . stateModel . load ( {
633633 mainContainerDimension : this . _mainContainerDimension ,
634634 resetLayout : Boolean ( this . layoutOptions ?. resetLayout )
@@ -1589,7 +1589,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
15891589 } ) ) ;
15901590 }
15911591
1592- this . _register ( this . storageService . onWillSaveState ( e => {
1592+ this . _register ( this . storageService . onWillSaveState ( ( ) => {
15931593
15941594 // Side Bar Size
15951595 const sideBarSize = this . stateModel . getRuntimeValue ( LayoutStateKeys . SIDEBAR_HIDDEN )
@@ -1613,6 +1613,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
16131613
16141614 this . stateModel . save ( true , true ) ;
16151615 } ) ) ;
1616+
1617+ this . _register ( Event . any ( this . paneCompositeService . onDidPaneCompositeOpen , this . paneCompositeService . onDidPaneCompositeClose ) ( ( ) => {
1618+
1619+ // Auxiliary Bar State
1620+ this . stateModel . setInitializationValue ( LayoutStateKeys . AUXILIARYBAR_EMPTY , this . paneCompositeService . getVisiblePaneCompositeIds ( ViewContainerLocation . AuxiliaryBar ) . length === 0 ) ;
1621+ } ) ) ;
16161622 }
16171623
16181624 layout ( ) : void {
@@ -2705,6 +2711,7 @@ const LayoutStateKeys = {
27052711 AUXILIARYBAR_SIZE : new InitializationStateKey < number > ( 'auxiliaryBar.size' , StorageScope . PROFILE , StorageTarget . MACHINE , 300 ) ,
27062712 PANEL_SIZE : new InitializationStateKey < number > ( 'panel.size' , StorageScope . PROFILE , StorageTarget . MACHINE , 300 ) ,
27072713
2714+ // Part State
27082715 PANEL_LAST_NON_MAXIMIZED_HEIGHT : new RuntimeStateKey < number > ( 'panel.lastNonMaximizedHeight' , StorageScope . PROFILE , StorageTarget . MACHINE , 300 ) ,
27092716 PANEL_LAST_NON_MAXIMIZED_WIDTH : new RuntimeStateKey < number > ( 'panel.lastNonMaximizedWidth' , StorageScope . PROFILE , StorageTarget . MACHINE , 300 ) ,
27102717 PANEL_WAS_LAST_MAXIMIZED : new RuntimeStateKey < boolean > ( 'panel.wasLastMaximized' , StorageScope . WORKSPACE , StorageTarget . MACHINE , false ) ,
@@ -2717,6 +2724,7 @@ const LayoutStateKeys = {
27172724 panelVisible : false ,
27182725 auxiliaryBarVisible : false
27192726 } ) ,
2727+ AUXILIARYBAR_EMPTY : new InitializationStateKey < boolean > ( 'auxiliaryBar.empty' , StorageScope . PROFILE , StorageTarget . MACHINE , false ) ,
27202728
27212729 // Part Positions
27222730 SIDEBAR_POSITON : new RuntimeStateKey < Position > ( 'sideBar.position' , StorageScope . WORKSPACE , StorageTarget . MACHINE , Position . LEFT ) ,
@@ -2776,8 +2784,6 @@ class LayoutStateModel extends Disposable {
27762784 private readonly storageService : IStorageService ,
27772785 private readonly configurationService : IConfigurationService ,
27782786 private readonly contextService : IWorkspaceContextService ,
2779- private readonly environmentService : IBrowserWorkbenchEnvironmentService ,
2780- private readonly viewDescriptorService : IViewDescriptorService
27812787 ) {
27822788 super ( ) ;
27832789
@@ -2847,28 +2853,11 @@ class LayoutStateModel extends Disposable {
28472853 LayoutStateKeys . AUXILIARYBAR_SIZE . defaultValue = Math . min ( 300 , mainContainerDimension . width / 4 ) ;
28482854 LayoutStateKeys . AUXILIARYBAR_HIDDEN . defaultValue = ( ( ) => {
28492855 const configuration = this . configurationService . inspect ( WorkbenchLayoutSettings . AUXILIARYBAR_DEFAULT_VISIBILITY ) ;
2850- if ( configuration . defaultValue !== 'hidden' && ! isConfigured ( configuration ) ) {
2851-
2852- // TODO@bpasero : lots of hacks here to not force open the auxiliary sidebar
2853- // when no Chat view is present within:
2854- // - revisit this when Chat is available in serverless web
2855- // - drop the need to probe for chat.setupContext
2856- // - drop the need to probe for chat.hideAIFeatures
2857- // - drop the need to probe for view location of workbench.panel.chat.view.copilot
2858-
2859- if ( isWeb && ! this . environmentService . remoteAuthority ) {
2860- return true ; // Chat view is not enabled
2861- }
2862-
2863- const context = this . storageService . getObject < { hidden ?: boolean ; disabled ?: boolean ; installed ?: boolean } > ( 'chat.setupContext' , StorageScope . PROFILE ) ;
2864- if ( context && ( ( context . installed && context . disabled ) || ( ! context . installed && context . hidden ) || ( ! context . installed && this . configurationService . getValue ( 'chat.hideAIFeatures' ) === true ) ) ) {
2865- return true ; // Chat view is hidden by user choice
2866- }
28672856
2868- const location = this . viewDescriptorService . getViewLocationById ( 'workbench.panel.chat.view.copilot' ) ;
2869- if ( location === ViewContainerLocation . Sidebar || location === ViewContainerLocation . Panel ) {
2870- return true ; // Chat view is not located in the auxiliary bar
2871- }
2857+ // Unless auxiliary bar visibility is explicitly configured, make
2858+ // sure to not force open it in case we know it was empty before.
2859+ if ( configuration . defaultValue !== 'hidden' && ! isConfigured ( configuration ) && this . stateCache . get ( LayoutStateKeys . AUXILIARYBAR_EMPTY . name ) ) {
2860+ return true ;
28722861 }
28732862
28742863 // New users: Show auxiliary bar even in empty workspaces
0 commit comments