You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Carousel view has invalid markdown rendering for "Viewed image..." #307446
Hi, I'm an external contributor and would love to take a stab at this if it's still open — happy to dig into the image carousel code. Would that be welcome? Dmitriy Vasyura (@dmitrivMS)
Tool invocations carry invocationMessage/pastTenseMessage typed string | IMarkdownString. Copilot's view-image tool produces markdown like Viewed image [](file:///…/homepage.png) (the empty-text link renders as a file widget in chat, but is raw syntax anywhere else).
chatImageExtraction.ts flattened the message to its raw markdown source via .value and stored that as the image caption.
The carousel editor renders captions as plain text (captionText.textContent = …, per its caption?: string contract), so the markdown syntax was displayed verbatim.
Fix
Preserve the message as string | IMarkdownString in chatImageExtraction.ts (common layer), and convert it to display text at the presentation layer in chatImageCarouselService.ts with a small toCaptionText() helper:
This is the same conversion the chat UI already applies when rendering these tool messages as labels (see chatToolProgressPart.ts), so the carousel caption now matches what the user sees in chat: Viewed image homepage.png (useLinkFormatter resolves empty-text links to the file basename).
Notes:
The conversion lives in the browser layer because renderAsPlaintext is in vs/base/browser and chatImageExtraction.ts is common-layer code.
The carousel editor (imageCarouselEditor.ts) is intentionally untouched — its plain-text caption contract is correct; the chat layer was handing it markdown.
Plain-string messages pass through verbatim; images without a tool message still show no caption.
Tests
Added a regression test in chatImageCarouselService.test.ts (strips markdown from tool invocation message captions) using the exact message shape from the issue, plus a passthrough assertion for plain-string messages.
Updated chatImageExtraction.test.ts assertions for the caption type change (captions from IMarkdownString messages now assert on .value).
Activity
arun-357 commentedon Jun 10, 2026
Hi, I'm an external contributor and would love to take a stab at this if it's still open — happy to dig into the image carousel code. Would that be welcome? Dmitriy Vasyura (@dmitrivMS)
dmitrivMS commentedon Jun 10, 2026
Arunachalam Nachiappan (@arun-357) Sure, go ahead.
arun-357 commentedon Jun 10, 2026
Hi, I've put together a fix for this — PR is open and ready for review whenever you get a chance. Dmitriy Vasyura (@dmitrivMS)
vs-code-engineering commentedon Jun 10, 2026
Sharing media and context from merged PR #320754 for verification:
Problem
The image carousel's bottom caption shows raw markdown instead of readable text, e.g.:
Root cause:
invocationMessage/pastTenseMessagetypedstring | IMarkdownString. Copilot's view-image tool produces markdown likeViewed image [](file:///…/homepage.png)(the empty-text link renders as a file widget in chat, but is raw syntax anywhere else).chatImageExtraction.tsflattened the message to its raw markdown source via.valueand stored that as the image caption.captionText.textContent = …, per itscaption?: stringcontract), so the markdown syntax was displayed verbatim.Fix
Preserve the message as
string | IMarkdownStringinchatImageExtraction.ts(common layer), and convert it to display text at the presentation layer inchatImageCarouselService.tswith a smalltoCaptionText()helper:This is the same conversion the chat UI already applies when rendering these tool messages as labels (see
chatToolProgressPart.ts), so the carousel caption now matches what the user sees in chat:Viewed image homepage.png(useLinkFormatterresolves empty-text links to the file basename).Notes:
renderAsPlaintextis invs/base/browserandchatImageExtraction.tsis common-layer code.imageCarouselEditor.ts) is intentionally untouched — its plain-text caption contract is correct; the chat layer was handing it markdown.Tests
chatImageCarouselService.test.ts(strips markdown from tool invocation message captions) using the exact message shape from the issue, plus a passthrough assertion for plain-string messages.chatImageExtraction.test.tsassertions for the caption type change (captions fromIMarkdownStringmessages now assert on.value).Before / After
Before:

After:

Source PR: #320754