Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,13 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
sessionsControl.reveal(sessionResource);
}
}));

// When showing sessions stacked, adjust the height of the sessions list to make room for chat input
this._register(chatWidget.onDidChangeContentHeight(() => {
if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked && this.lastDimensions) {
this.layoutBody(this.lastDimensions.height, this.lastDimensions.width);
}
}));
Comment on lines +655 to +659
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onDidChangeContentHeight event fires frequently during content updates. This listener triggers a full layoutBody call every time, which could cause performance issues. Consider debouncing this event or checking if the height actually changed meaningfully before triggering a re-layout. You could use a RunOnceScheduler or check if the height delta exceeds a threshold before re-layouting.

Copilot uses AI. Check for mistakes.
}

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

//#region Layout

private layoutingBody = false;

protected override layoutBody(height: number, width: number): void {
if (this.layoutingBody) {
return; // prevent re-entrancy
}

this.layoutingBody = true;
try {
this.doLayoutBody(height, width);
} finally {
this.layoutingBody = false;
}
}

private doLayoutBody(height: number, width: number): void {
super.layoutBody(height, width);

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

let availableSessionsHeight = height - this.sessionsTitleContainer.offsetHeight - this.sessionsLinkContainer.offsetHeight;
if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked) {
availableSessionsHeight -= ChatViewPane.MIN_CHAT_WIDGET_HEIGHT; // always reserve some space for chat input
availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? 0);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback to 0 when this._widget?.input?.contentHeight is undefined means the calculation would use only MIN_CHAT_WIDGET_HEIGHT. However, if the widget or input doesn't exist, this should probably use MIN_CHAT_WIDGET_HEIGHT explicitly rather than relying on Math.max to select it. Consider making this logic more explicit: this._widget?.input?.contentHeight ?? ChatViewPane.MIN_CHAT_WIDGET_HEIGHT.

Suggested change
availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? 0);
availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? ChatViewPane.MIN_CHAT_WIDGET_HEIGHT);

Copilot uses AI. Check for mistakes.
}

// Show as sidebar
Expand Down
Loading