Skip to content

Commit 2901c5a

Browse files
authored
Fix hiding all content when responseIsFiltered: true (#252244)
Fix hiding all content when responseIsFiltered: true (#252050) * Fix hiding all content when responseIsFiltered: true For microsoft/vscode-copilot-release#12599 * Respect errorDetails.level when errorDetails.confirmationButtons
1 parent ed7e764 commit 2901c5a

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

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

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -551,29 +551,23 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
551551
templateData.rowContainer.classList.toggle('chat-response-loading', (isResponseVM(element) && !element.isComplete));
552552

553553
const content: IChatRendererContent[] = [];
554-
// Always add the references to avoid shifting the content parts when a reference is added, and having to re-diff all the content.
555-
// The part will hide itself if the list is empty.
556-
content.push({ kind: 'references', references: element.contentReferences });
557-
content.push(...annotateSpecialMarkdownContent(element.response.value));
558-
if (element.codeCitations.length) {
559-
content.push({ kind: 'codeCitations', citations: element.codeCitations });
554+
const isFiltered = !!element.errorDetails?.responseIsFiltered;
555+
if (!isFiltered) {
556+
// Always add the references to avoid shifting the content parts when a reference is added, and having to re-diff all the content.
557+
// The part will hide itself if the list is empty.
558+
content.push({ kind: 'references', references: element.contentReferences });
559+
content.push(...annotateSpecialMarkdownContent(element.response.value));
560+
if (element.codeCitations.length) {
561+
content.push({ kind: 'codeCitations', citations: element.codeCitations });
562+
}
560563
}
561564

562565
if (element.errorDetails?.message && element.errorDetails.message !== canceledName) {
563566
content.push({ kind: 'errorDetails', errorDetails: element.errorDetails, isLast: index === this.delegate.getListLength() - 1 });
564567
}
565568

566-
const isFiltered = !!element.errorDetails?.responseIsFiltered;
567-
if (!isFiltered) {
568-
const diff = this.diff(templateData.renderedParts ?? [], content, element);
569-
this.renderChatContentDiff(diff, content, element, index, templateData);
570-
} else {
571-
dom.clearNode(templateData.value);
572-
if (templateData.renderedParts) {
573-
dispose(templateData.renderedParts);
574-
}
575-
templateData.renderedParts = [];
576-
}
569+
const diff = this.diff(templateData.renderedParts ?? [], content, element);
570+
this.renderChatContentDiff(diff, content, element, index, templateData);
577571

578572
this.updateItemHeightOnRender(element, templateData);
579573
}
@@ -978,7 +972,8 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
978972
renderedError.addDisposable(renderedError.onDidChangeHeight(() => this.updateItemHeight(templateData)));
979973
return renderedError;
980974
} else if (content.errorDetails.confirmationButtons && isLast) {
981-
const errorConfirmation = this.instantiationService.createInstance(ChatErrorConfirmationContentPart, ChatErrorLevel.Error, new MarkdownString(content.errorDetails.message), content, content.errorDetails.confirmationButtons, this.renderer, context);
975+
const level = content.errorDetails.level ?? (content.errorDetails.responseIsFiltered ? ChatErrorLevel.Info : ChatErrorLevel.Error);
976+
const errorConfirmation = this.instantiationService.createInstance(ChatErrorConfirmationContentPart, level, new MarkdownString(content.errorDetails.message), content, content.errorDetails.confirmationButtons, this.renderer, context);
982977
errorConfirmation.addDisposable(errorConfirmation.onDidChangeHeight(() => this.updateItemHeight(templateData)));
983978
return errorConfirmation;
984979
} else {

0 commit comments

Comments
 (0)