Skip to content

Commit fa0a83c

Browse files
committed
Agent sessions: rendering bug when stacked sessions list is expanded and context is added (fix #288151)
1 parent c9c76f1 commit fa0a83c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,13 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
650650
sessionsControl.reveal(sessionResource);
651651
}
652652
}));
653+
654+
// When showing sessions stacked, adjust the height of the sessions list to make room for chat input
655+
this._register(chatWidget.onDidChangeContentHeight(() => {
656+
if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked && this.lastDimensions) {
657+
this.layoutBody(this.lastDimensions.height, this.lastDimensions.width);
658+
}
659+
}));
653660
}
654661

655662
private setupContextMenu(parent: HTMLElement): void {
@@ -795,7 +802,22 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
795802

796803
//#region Layout
797804

805+
private layoutingBody = false;
806+
798807
protected override layoutBody(height: number, width: number): void {
808+
if (this.layoutingBody) {
809+
return; // prevent re-entrancy
810+
}
811+
812+
this.layoutingBody = true;
813+
try {
814+
this.doLayoutBody(height, width);
815+
} finally {
816+
this.layoutingBody = false;
817+
}
818+
}
819+
820+
private doLayoutBody(height: number, width: number): void {
799821
super.layoutBody(height, width);
800822

801823
this.lastDimensions = { height, width };
@@ -906,7 +928,7 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
906928

907929
let availableSessionsHeight = height - this.sessionsTitleContainer.offsetHeight - this.sessionsLinkContainer.offsetHeight;
908930
if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked) {
909-
availableSessionsHeight -= ChatViewPane.MIN_CHAT_WIDGET_HEIGHT; // always reserve some space for chat input
931+
availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? 0);
910932
}
911933

912934
// Show as sidebar

0 commit comments

Comments
 (0)