From fc07512ec01cdffcf70856cfd7267b004023f889 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 7 Jan 2026 11:21:50 +0100 Subject: [PATCH] Strange UI behaviour when Show Agent Session sidebar (fix #286166) (#286327) --- .../agentSessions/agentSessionsActions.ts | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.ts b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.ts index b56bf1946cd..2f7a52f5d6f 100644 --- a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.ts +++ b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.ts @@ -716,6 +716,7 @@ abstract class UpdateChatViewWidthAction extends Action2 { } const newOrientation = this.getOrientation(); + const lastWidthForOrientation = chatView?.getLastDimensions(newOrientation)?.width; if ((!canResizeView || validatedConfiguredOrientation === 'sideBySide') && newOrientation === AgentSessionsViewerOrientation.Stacked) { chatView.updateConfiguredSessionsViewerOrientation('stacked'); @@ -723,21 +724,21 @@ abstract class UpdateChatViewWidthAction extends Action2 { chatView.updateConfiguredSessionsViewerOrientation('sideBySide'); } + if (!canResizeView) { + return; // location does not allow for resize (panel top or bottom) + } + const part = getPartByLocation(chatLocation); let currentSize = layoutService.getSize(part); - const sideBySideMinWidth = 600 + 1; // account for possible theme border - const stackedMaxWidth = sideBySideMinWidth - 1; + const chatViewDefaultWidth = 300; + const sideBySideMinWidth = (chatViewDefaultWidth * 2) + 1; // account for possible theme border if ( - (newOrientation === AgentSessionsViewerOrientation.SideBySide && currentSize.width >= sideBySideMinWidth) || // already wide enough to show side by side - newOrientation === AgentSessionsViewerOrientation.Stacked // always wide enough to show stacked + (newOrientation === AgentSessionsViewerOrientation.SideBySide && currentSize.width >= sideBySideMinWidth) || // already wide enough to show side by side + (newOrientation === AgentSessionsViewerOrientation.Stacked && chatLocation === ViewContainerLocation.AuxiliaryBar && layoutService.isAuxiliaryBarMaximized()) // try to not leave maximized state if maximized ) { - return; // size suffices - } - - if (!canResizeView) { - return; // location does not allow for resize (panel top or bottom) + return; } if (chatLocation === ViewContainerLocation.AuxiliaryBar) { @@ -745,19 +746,14 @@ abstract class UpdateChatViewWidthAction extends Action2 { currentSize = layoutService.getSize(part); } - const lastWidthForOrientation = chatView?.getLastDimensions(newOrientation)?.width; - let newWidth: number; if (newOrientation === AgentSessionsViewerOrientation.SideBySide) { newWidth = Math.max(sideBySideMinWidth, lastWidthForOrientation || Math.round(layoutService.mainContainerDimension.width / 2)); } else { - newWidth = Math.min(stackedMaxWidth, lastWidthForOrientation || stackedMaxWidth); + newWidth = lastWidthForOrientation || chatViewDefaultWidth; } - layoutService.setSize(part, { - width: newWidth, - height: currentSize.height - }); + layoutService.setSize(part, { width: newWidth, height: currentSize.height }); } abstract getOrientation(): AgentSessionsViewerOrientation;