Skip to content

Conversation

@bpasero
Copy link
Member

@bpasero bpasero commented Jan 16, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 16, 2026 14:40
@bpasero bpasero enabled auto-merge (squash) January 16, 2026 14:40
@bpasero bpasero self-assigned this Jan 16, 2026
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the ChatViewPane to improve the relayout logic by extracting the repeated pattern of checking lastDimensions before calling layoutBody into a dedicated relayout() helper method.

Changes:

  • Introduced a new relayout() helper method that checks lastDimensions before calling layoutBody
  • Replaced all instances of the pattern if (this.lastDimensions) { this.layoutBody(...) } with calls to relayout()
  • Removed the fromEvent parameter from updateContextKeys() method and removed the conditional layout call within it
  • Added initialization of sessionsViewerVisible field in constructor
  • Changed event listener from onDidChangeContentHeight to input.onDidChangeHeight for better specificity

Comment on lines +650 to +651
this._register(chatWidget.input.onDidChangeHeight(() => {
if (this.sessionsViewerVisible && this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked) {
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 condition at line 651 now checks sessionsViewerVisible before sessionsViewerOrientation, but the previous implementation listened to onDidChangeContentHeight which fired when the entire content height changed, not just the input. The new implementation uses input.onDidChangeHeight() which is more specific but may miss other content height changes. Consider whether this narrower event listener could miss legitimate relayout triggers that were previously handled, particularly when chat content (not input) changes height in stacked mode.

See below for a potential fix:

		const maybeRelayoutForStackedSessions = () => {
			if (this.sessionsViewerVisible && this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked) {
				this.relayout();
			}
		};

		// When showing sessions stacked, adjust the height of the sessions list to make room for chat input
		this._register(chatWidget.input.onDidChangeHeight(() => {
			maybeRelayoutForStackedSessions();
		}));

		// Also react to overall chat content height changes, not just input height,
		// to keep stacked sessions layout in sync with expanding/collapsing content.
		this._register(chatWidget.onDidChangeContentHeight(() => {
			maybeRelayoutForStackedSessions();
		}));

Copilot uses AI. Check for mistakes.
@bpasero bpasero merged commit d116958 into main Jan 16, 2026
27 of 28 checks passed
@bpasero bpasero deleted the ben/hilarious-rooster branch January 16, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants