Change:
Repro: terminal chat "list files in various ways" height of terminal !
, we'd need a way to set max height for the chat widget, which there isn't currently AFAICT
You need to call layout with the sizes you want
i tried that and didn't see the height taking effect, only the width.

Discussion:
protected _doLayout(widgetDimension: Dimension, inputDimension: Dimension): void { this._elements.progress.style.width = `${inputDimension.width}px`; this._chatMessageContents.style.width = `${widgetDimension.width - 10}px`; <del> this._chatMessageContents.style.maxHeight = `270px`; </del> <ins> this._chatMessageContents.style.maxHeight = Math.min(270, widgetDimension.height) + 'px'; </ins> this._inputWidget.layout(inputDimension); }

this._chatAccessibilityService.acceptResponse(responseContent, accessibilityRequestId); const containsCode = responseContent.includes('```'); this._chatWidget?.value.inlineChatWidget.updateChatMessage({ message: new MarkdownString(responseContent), requestId: this._currentRequest.id, providerId: 'terminal' }, false, containsCode); <del> // the message grows in height, be sure to update top position so it doesn't go below the terminal this._chatWidget?.value.layoutVertically(); </del> <ins> this._chatWidget?.value.updateHeight(); </ins> this._responseContainsCodeBlockContextKey.set(containsCode); this._chatWidget?.value.inlineChatWidget.updateToolbar(true); this._messages.fire(Message.ACCEPT_INPUT);

import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal'; import { MENU_TERMINAL_CHAT_INPUT, MENU_TERMINAL_CHAT_WIDGET, MENU_TERMINAL_CHAT_WIDGET_FEEDBACK, MENU_TERMINAL_CHAT_WIDGET_STATUS, TerminalChatContextKeys } from 'vs/workbench/contrib/terminalContrib/chat/browser/terminalChat'; <ins> const widgetHeightMargin = 100; const widgetWidthMargin = 40; </ins> export class TerminalChatWidget extends Disposable { private readonly _container: HTMLElement;

this._focusedContextKey.set(true); this._visibleContextKey.set(true); this._inlineChatWidget.focus(); <del> this.layoutVertically(); </del> <ins> this.updateHeight(); </ins> this._updateWidth(); <del> this._register(this._instance.onDimensionsChanged(() => this._updateWidth())); </del> <ins> this._register(this._instance.onDimensionsChanged(() => { this.updateHeight(); this._updateWidth(); })); </ins> } <del> layoutVertically(): void { </del> <ins> private _updateVerticalPosition(): void { </ins> const font = this._instance.xterm?.getFont(); if (!font?.charHeight) { return;

const height = font.charHeight * font.lineHeight; const top = cursorY * height + 12; this._container.style.top = `${top}px`; <del> const terminalHeight = this._instance.domElement.clientHeight; if (terminalHeight && top > terminalHeight - this._inlineChatWidget.getHeight()) { </del> <ins> const widgetHeight = this._inlineChatWidget.getHeight(); const terminalHeight = this._getTerminalHeight(); if (!terminalHeight) { return; } if (top > terminalHeight - widgetHeight) { </ins> this._container.style.top = ''; } } <ins> private _getTerminalHeight(): number | undefined { const font = this._instance.xterm?.getFont(); if (!font?.charHeight) { return; } return font.charHeight * font.lineHeight * this._instance.rows; } updateHeight() { const terminalHeight = this._getTerminalHeight(); if (!terminalHeight || terminalHeight < widgetHeightMargin) { return; } this._inlineChatWidget.layout(new Dimension(this._inlineChatWidget.domNode.clientWidth, terminalHeight - widgetHeightMargin)); this._updateVerticalPosition(); } </ins> private _updateWidth() { const terminalWidth = this._instance.domElement.clientWidth; if (terminalWidth && terminalWidth < 640) { <del> this._inlineChatWidget.layout(new Dimension(terminalWidth - 40, this._inlineChatWidget.getHeight())); </del> <ins> this._inlineChatWidget.layout(new Dimension(terminalWidth - widgetWidthMargin, this._inlineChatWidget.getHeight())); </ins> } }