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:
Justin Chen
2026-03-23 15:45:32 -07:00
committed by GitHub
parent 8978366531
commit 5785d325af

View File

@@ -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)) {