Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes rendering of response that is below the fold #191337

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/vs/workbench/contrib/chat/browser/chatListRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,15 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
templateData.contextKeyService));
}

element.currentRenderedHeight = templateData.rowContainer.offsetHeight;
const newHeight = templateData.rowContainer.offsetHeight;
const fireEvent = !element.currentRenderedHeight || element.currentRenderedHeight !== newHeight;
element.currentRenderedHeight = newHeight;
if (fireEvent) {
const disposable = this._register(dom.scheduleAtNextAnimationFrame(() => {
disposable.dispose();
this._onDidChangeItemHeight.fire({ element, height: newHeight });
}));
}
}

private renderWelcomeMessage(element: IChatWelcomeMessageViewModel, templateData: IChatListItemTemplate) {
Expand All @@ -381,7 +389,15 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
}
}

element.currentRenderedHeight = templateData.rowContainer.offsetHeight;
const newHeight = templateData.rowContainer.offsetHeight;
const fireEvent = !element.currentRenderedHeight || element.currentRenderedHeight !== newHeight;
element.currentRenderedHeight = newHeight;
if (fireEvent) {
const disposable = this._register(dom.scheduleAtNextAnimationFrame(() => {
disposable.dispose();
this._onDidChangeItemHeight.fire({ element, height: newHeight });
}));
}
}

/**
Expand Down
5 changes: 2 additions & 3 deletions src/vs/workbench/contrib/chat/browser/chatWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
this._register(this.renderer.onDidChangeItemHeight(() => this.layoutDynamicChatTreeItemMode()));
}

layoutDynamicChatTreeItemMode(allowRecurse = true): void {
layoutDynamicChatTreeItemMode(): void {
if (!this.viewModel) {
return;
}
Expand All @@ -554,10 +554,9 @@ export class ChatWidget extends Disposable implements IChatWidget {
this.container.offsetWidth
);

if (needsRerender && allowRecurse) {
if (needsRerender) {
// TODO: figure out a better place to reveal the last element
revealLastElement(this.tree);
this.layoutDynamicChatTreeItemMode(false);
}
}

Expand Down