mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-17 15:24:40 +01:00
add debounce for working shimmer (#304285)
* add debounce for working shimmer * Update src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * revert ccr --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -114,6 +114,7 @@ import { isMcpToolInvocation } from './chatContentParts/toolInvocationParts/chat
|
||||
const $ = dom.$;
|
||||
|
||||
const COPILOT_USERNAME = 'GitHub Copilot';
|
||||
const WORKING_CAUGHT_UP_DEBOUNCE_MS = 50;
|
||||
|
||||
export interface IChatListItemTemplate {
|
||||
currentElement?: ChatTreeItem;
|
||||
@@ -1067,7 +1068,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
|
||||
if (
|
||||
!lastPart ||
|
||||
lastPart.kind === 'references' ||
|
||||
(lastPart.kind === 'markdownContent' && !moreContentAvailable) ||
|
||||
(lastPart.kind === 'markdownContent' && !moreContentAvailable && this.hasBeenCaughtUpLongEnough(element)) ||
|
||||
((lastPart.kind === 'toolInvocation' || lastPart.kind === 'toolInvocationSerialized') && (IChatToolInvocation.isComplete(lastPart) || lastPart.presentation === 'hidden')) ||
|
||||
((lastPart.kind === 'textEditGroup' || lastPart.kind === 'notebookEditGroup') && lastPart.done && !partsToRender.some(part => part.kind === 'toolInvocation' && !IChatToolInvocation.isComplete(part))) ||
|
||||
(lastPart.kind === 'progressTask' && lastPart.deferred.isSettled) ||
|
||||
@@ -1081,6 +1082,17 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a debounce on when to show "working" shimmer.
|
||||
*/
|
||||
private hasBeenCaughtUpLongEnough(element: IChatResponseViewModel): boolean {
|
||||
const lastRenderTime = element.renderData?.lastRenderTime;
|
||||
if (typeof lastRenderTime !== 'number' || lastRenderTime === 0) {
|
||||
return false;
|
||||
}
|
||||
return (Date.now() - lastRenderTime) >= WORKING_CAUGHT_UP_DEBOUNCE_MS;
|
||||
}
|
||||
|
||||
|
||||
private getChatFileChangesSummaryPart(element: IChatResponseViewModel): IChatChangesSummaryPart | undefined {
|
||||
if (!this.shouldShowFileChangesSummary(element)) {
|
||||
|
||||
Reference in New Issue
Block a user