Skip to content

Commit 0cea2ed

Browse files
meganroggeCopilot
andauthored
Update src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 58855be commit 0cea2ed

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -736,14 +736,16 @@ export class ChatQuestionCarouselPart extends Disposable implements IChatContent
736736
const isLong = messageContent.length > QUESTION_TITLE_TRUNCATION_THRESHOLD;
737737
const renderTitle = (expanded: boolean) => {
738738
dom.clearNode(title);
739-
const rawValue = isMarkdownString(questionText) ? questionText.value : questionText;
740-
const displayValue = (isLong && !expanded)
741-
? rawValue.slice(0, QUESTION_TITLE_TRUNCATION_THRESHOLD).replace(/\s+\S*$/, '') + '…'
742-
: rawValue;
743-
const suffixed = question.required ? `${displayValue} *` : displayValue;
744-
const md = isMarkdownString(questionText)
745-
? new MarkdownString(suffixed, { isTrusted: questionText.isTrusted, supportThemeIcons: questionText.supportThemeIcons })
746-
: new MarkdownString(suffixed);
739+
const plainTextValue = isMarkdownString(questionText) ? renderAsPlaintext(questionText) : questionText;
740+
const collapsedValue = isLong
741+
? plainTextValue.slice(0, QUESTION_TITLE_TRUNCATION_THRESHOLD).replace(/\s+\S*$/, '') + '…'
742+
: plainTextValue;
743+
const md = expanded && isMarkdownString(questionText)
744+
? new MarkdownString(
745+
question.required ? `${questionText.value} *` : questionText.value,
746+
{ isTrusted: questionText.isTrusted, supportThemeIcons: questionText.supportThemeIcons }
747+
)
748+
: new MarkdownString(question.required ? `${collapsedValue} *` : collapsedValue);
747749
const rendered = questionRenderStore.add(this._markdownRendererService.render(md));
748750
title.appendChild(rendered.element);
749751
};

0 commit comments

Comments
 (0)