inline chat layout fixes (#208833)

* move padding into status element so that empty status doesn't report height

fixes https://github.com/microsoft/vscode/issues/208419

* inline chat layout fixes

- allow to define default element height which fixes unexpected large inline chat on first render,
- properly set editor overflow widget
This commit is contained in:
Johannes Rieken 2024-03-26 23:01:53 +01:00 committed by GitHub
parent 59a81503c7
commit f541620354
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 10 additions and 5 deletions

View file

@ -98,6 +98,7 @@ export interface IChatWidgetViewOptions {
inputSideToolbar?: MenuId;
telemetrySource?: string;
};
defaultElementHeight?: number;
editorOverflowWidgetsDomNode?: HTMLElement;
}

View file

@ -1010,6 +1010,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
export class ChatListDelegate implements IListVirtualDelegate<ChatTreeItem> {
constructor(
private readonly defaultElementHeight: number,
@ILogService private readonly logService: ILogService
) { }
@ -1023,7 +1024,7 @@ export class ChatListDelegate implements IListVirtualDelegate<ChatTreeItem> {
getHeight(element: ChatTreeItem): number {
const kind = isRequestVM(element) ? 'request' : 'response';
const height = ('currentRenderedHeight' in element ? element.currentRenderedHeight : undefined) ?? 200;
const height = ('currentRenderedHeight' in element ? element.currentRenderedHeight : undefined) ?? this.defaultElementHeight;
this._traceLayout('getHeight', `${kind}, height=${height}`);
return height;
}

View file

@ -396,7 +396,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
private createList(listContainer: HTMLElement, options: IChatListItemRendererOptions): void {
const scopedInstantiationService = this.instantiationService.createChild(new ServiceCollection([IContextKeyService, this.contextKeyService]));
const delegate = scopedInstantiationService.createInstance(ChatListDelegate);
const delegate = scopedInstantiationService.createInstance(ChatListDelegate, this.viewOptions.defaultElementHeight ?? 200);
const rendererDelegate: IChatRendererDelegate = {
getListLength: () => this.tree.getNode(null).visibleChildrenCount,
onDidScroll: this.onDidScroll,

View file

@ -64,6 +64,7 @@ export class InlineChatContentWidget implements IContentWidget {
ChatAgentLocation.Editor,
{ resource: true },
{
defaultElementHeight: 32,
editorOverflowWidgetsDomNode: _editor.getOverflowWidgetsDomNode(),
renderStyle: 'compact',
renderInputOnTop: true,

View file

@ -189,10 +189,11 @@ export class InlineChatWidget {
location,
{ resource: true },
{
// TODO@jrieken support editable code blocks
defaultElementHeight: 32,
renderStyle: 'compact',
renderInputOnTop: true,
supportsFileReferences: true,
editorOverflowWidgetsDomNode: options.editorOverflowWidgetsDomNode,
editableCodeBlocks: options.editableCodeBlocks,
menus: {
executeToolbar: options.inputMenuId,

View file

@ -50,12 +50,12 @@
/* status */
.monaco-workbench .inline-chat .status {
padding-top: 4px;
display: flex;
justify-content: space-between;
align-items: center;
}
.monaco-workbench .inline-chat .status .actions.hidden {
display: none;
}
@ -64,7 +64,7 @@
overflow: hidden;
color: var(--vscode-descriptionForeground);
font-size: 11px;
align-self: baseline;
padding-top: 4px;
padding-left: 10px;
display: inline-flex;
}
@ -130,6 +130,7 @@
.monaco-workbench .inline-chat .status .actions {
display: flex;
padding-top: 4px;
}
.monaco-workbench .inline-chat .status .actions > .monaco-button,