Skip to content

Commit db467a8

Browse files
committed
address comments
1 parent 54b8986 commit db467a8

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { ITreeNode, ITreeRenderer } from '../../../../base/browser/ui/tree/tree.
1515
import { IAction } from '../../../../base/common/actions.js';
1616
import { coalesce, distinct } from '../../../../base/common/arrays.js';
1717
import { Codicon } from '../../../../base/common/codicons.js';
18+
import { findLast } from '../../../../base/common/arraysFind.js';
1819
import { toErrorMessage } from '../../../../base/common/errorMessage.js';
1920
import { canceledName } from '../../../../base/common/errors.js';
2021
import { Emitter, Event } from '../../../../base/common/event.js';
@@ -717,9 +718,6 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
717718
content.push({ kind: 'errorDetails', errorDetails: element.errorDetails, isLast: index === this.delegate.getListLength() - 1 });
718719
}
719720

720-
if (!element.isComplete && this.shouldShowWorkingProgress(element, content)) {
721-
content.push({ kind: 'working' });
722-
}
723721
const fileChangesSummaryPart = this.getChatFileChangesSummaryPart(element);
724722
if (fileChangesSummaryPart) {
725723
content.push(fileChangesSummaryPart);
@@ -732,20 +730,24 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
732730
}
733731

734732
private shouldShowWorkingProgress(element: IChatResponseViewModel, partsToRender: IChatRendererContent[]): boolean {
735-
if (!isResponseVM(element) || element.isComplete) {
733+
if (element.agentOrSlashCommandDetected || this.rendererOptions.renderStyle === 'minimal' || element.isComplete || !checkModeOption(this.delegate.currentChatMode(), this.rendererOptions.progressMessageAtBottomOfResponse)) {
736734
return false;
737735
}
738736

739-
if (!partsToRender.length) {
737+
// Show if no content, only "used references", ends with a complete tool call, or ends with complete text edits and there is no incomplete tool call (edits are still being applied some time after they are all generated)
738+
const lastPart = findLast(partsToRender, part => part.kind !== 'markdownContent' || part.content.value.trim().length > 0);
739+
if (
740+
!lastPart ||
741+
lastPart.kind === 'references' ||
742+
(lastPart.kind === 'toolInvocation' && (lastPart.isComplete || lastPart.presentation === 'hidden')) ||
743+
((lastPart.kind === 'textEditGroup' || lastPart.kind === 'notebookEditGroup') && lastPart.done && !partsToRender.some(part => part.kind === 'toolInvocation' && !part.isComplete)) ||
744+
(lastPart.kind === 'progressTask' && lastPart.deferred.isSettled) ||
745+
lastPart.kind === 'prepareToolInvocation'
746+
) {
740747
return true;
741748
}
742749

743-
const lastPart = partsToRender.at(-1)!;
744-
return !(
745-
lastPart.kind === 'markdownContent' ||
746-
lastPart.kind === 'references' ||
747-
lastPart.kind === 'codeCitations'
748-
);
750+
return false;
749751
}
750752

751753
private getChatFileChangesSummaryPart(element: IChatResponseViewModel): IChatChangesSummaryPart | undefined {
@@ -1072,6 +1074,10 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
10721074
element.renderData = { lastRenderTime: Date.now(), renderedWordCount: newRenderedWordCount, renderedParts: partsToRender };
10731075
}
10741076

1077+
if (this.shouldShowWorkingProgress(element, partsToRender)) {
1078+
partsToRender.push({ kind: 'working' });
1079+
}
1080+
10751081
const fileChangesSummaryPart = this.getChatFileChangesSummaryPart(element);
10761082
if (fileChangesSummaryPart) {
10771083
partsToRender.push(fileChangesSummaryPart);

0 commit comments

Comments
 (0)