Skip to content

Include mermaid tool output when copying chat responses#292772

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-copy-chat-diagrams
Draft

Include mermaid tool output when copying chat responses#292772
Copilot wants to merge 3 commits intomainfrom
copilot/fix-copy-chat-diagrams

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Description

Copying chat responses omitted rendered mermaid diagrams when the output came from renderMermaidDiagram tool invocations. This update ensures mermaid tool output is serialized into the copied response text as a proper fenced mermaid block.

  • Tool output serialization
    • Include tool result output details in response stringification.
    • Special-case text/vnd.mermaid to emit fenced mermaid markdown for copy.
  • Test coverage
    • Add a response string unit test for mermaid tool output.
const fence = getFenceForContent(mermaidSource);
const copied = `${fence}mermaid\n${mermaidSource}\n${fence}`;
Original prompt

This section details on the original issue you should resolve

<issue_title>Copy Chat doesn't copy diagrams when using renderMermaidDiagram </issue_title>
<issue_description>
Type: Bug

Copy Chat doesn't copy diagrams when using renderMermaidDiagram

1- Ask to create diagrams using renderMermaidDiagrams
2- Right click and copy response
3- paste in a markdown file - Note no mermaid diagrams <-

Image

Extension version: 0.37.2026020404
VS Code version: Code - Insiders 1.109.0-insider (Universal) (bdd88df, 2026-02-04T02:00:40.203Z)
OS version: Darwin arm64 25.2.0
Modes:

Logs
Trace: choice {"delta":{"content":""},"finish_reason":null}
Trace: [NES][NextEditProvider][f842][_getNextEdit][fetchNextEdit][_executeNewNextEditRequest][XtabProvider][doGetNextEditWithSelection][streamEditsWithFiltering][streamEdits] starting to diff stream against edit window lines with latency 281.1888750000071 ms
Trace: choice {"delta":{"content":"\n\n"},"finish_reason":null}
Trace: [NES][NextEditProvider][f842][_getNextEdit][fetchNextEdit][_executeNewNextEditRequest][XtabProvider][doGetNextEditWithSelection][streamEditsWithFiltering][streamEdits] Line 0 emitted with latency 281.65779199999815 ms
Trace: choice {"delta":{"content":"Here"},"finish_reason":null}
Trace: [NES][NextEditProvider][f842][_getNextEdit][fetchNextEdit][_executeNewNextEditRequest][XtabProvider][doGetNextEditWithSelection][streamEditsWithFiltering][streamEdits] Line 1 emitted with latency 281.68758300000627 ms
Trace: choice {"delta":{"content":"’s"},"finish_reason":null}
Trace: choice {"delta":{"content":" an"},"finish_reason":null}
Trace: choice {"delta":{"content":" example"},"finish_reason":null}
Trace: choice {"delta":{"content":" Mermaid"},"finish_reason":null}
Trace: choice {"delta":{"content":" diagram"},"finish_reason":null}
Trace: choice {"delta":{"content":" rendered"},"finish_reason":null}
Trace: choice {"delta":{"content":"."},"finish_reason":null}
Trace: choice {"delta":{"content":" Want"},"finish_reason":null}
Trace: choice {"delta":{"content":" a"},"finish_reason":null}
Trace: choice {"delta":{"content":" different"},"finish_reason":null}
Trace: choice {"delta":{"content":" style"},"finish_reason":null}
Trace: choice {"delta":{"content":" ("},"finish_reason":null}
Trace: choice {"delta":{"content":"sequence"},"finish_reason":null}
Trace: choice {"delta":{"content":","},"finish_reason":null}
Trace: choice {"delta":{"content":" class"},"finish_reason":null}
Trace: choice {"delta":{"content":","},"finish_reason":null}
Trace: choice {"delta":{"content":" G"},"finish_reason":null}
Trace: choice {"delta":{"content":"antt"},"finish_reason":null}
Trace: choice {"delta":{"content":")"},"finish_reason":null}
Trace: choice {"delta":{"content":" or"},"finish_reason":null}
Trace: choice {"delta":{"content":" theme"},"finish_reason":null}
Trace: choice {"delta":{"content":"?"},"finish_reason":null}
Trace: choice {"delta":{"content":""},"finish_reason":"stop"}
Info: message 0 returned. finish reason: [stop]
Debug: message 0 details: finishOffset: [undefined] completionId: [{}] created: [{1770184114}]
Info: request done: requestId: [17d96803-ebf1-4c9e-99df-f663f5cae2d7] model deployment ID: []
Info: ccreq:2b187fe6.copilotmd | success | copilot-nes-oct | 490ms | [XtabProvider]
Trace: [NES][NextEditProvider][f842][_getNextEdit][fetchNextEdit][_executeNewNextEditRequest][XtabProvider][doGetNextEditWithSelection][streamEditsWithFiltering][streamEdits] Line 2 emitted with latency 492.47849999999744 ms
Trace: [NES][NextEditProvider][f842][_getNextEdit][fetchNextEdit][_executeNewNextEditRequest][pushEdit] processing edit microsoft/vscode#0 (starts at 0)
Trace: [NES][NextEditProvider][f842][_getNextEdit][fetchNextEdit][_executeNewNextEditRequest][pushEdit] resetting shouldExpandEditWindow to false due to NoSuggestions
Trace: [NES][NextEditProvider][f842][_getNextEdit][fetchNextEdit][_executeNewNextEditRequest][pushEdit] no edit, reason: noSuggestions
Trace: [NES][NextEditProvider][f842][_getNextEdit] resolved firstEdit promise
Trace: [NES][NextEditProvider][f842][_getNextEdit] First edit latency: 2601 ms
Trace: [NES][NextEditProvider][f842][_getNextEdit] failed to fetch next edit noSuggestions
Trace: [NES][NextEditProvider][f842][_getNextEdit] had no edit
Trace: [NES][Provider][provideInlineCompletionItems][f842] giving some more time to diagnostics provider
Trace: [NES][DiagnosticsNextEditProvider] DiagnosticsInlineCompletionProvider runUntilNextEdit complete (cancelled)
Trace: [NES][Provider][provideInlineCompletionItems][f842] no next edit suggestion
Info: ccreq:2c450338.copilotmd | markdown
Trace: [NES][Provider][handleListEndOfLifetime][f842] List icr-f842b294-24ff-447b-99e1-22dc724a79e9 disposed, reason: Empty
Error: Error: Failed to fetch custom instructi...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 4, 2026 06:40
Co-authored-by: pierceboggan <1091304+pierceboggan@users.noreply.github.com>
Co-authored-by: pierceboggan <1091304+pierceboggan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with diagrams not copying from Chat Include mermaid tool output when copying chat responses Feb 4, 2026
Copilot AI requested a review from pierceboggan February 4, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy Chat doesn't copy diagrams when using renderMermaidDiagram

2 participants