Skip to content

Copy button for code snippets only works after AI finishes streaming response #255290

Closed

Description

@naman-msft

Description:
When GitHub Copilot Chat streams code snippets as part of its response, the “Copy” button next to each snippet is disabled or unresponsive until the AI has fully completed its answer. If you try to click “Copy” while the snippet is still rendering, nothing happens. You must wait for the response to finish before copying.


Steps to Reproduce:

  1. Open VS Code with the GitHub Copilot Chat extension enabled.
  2. Ask a question that generates multi‑line code (e.g., “Show me a Node.js HTTP server example.”).
  3. As the AI streams its answer, hover over the partially rendered code block.
  4. Click the “Copy” button beside the snippet before the AI finishes streaming.
  5. Observe that nothing is copied to the clipboard.
  6. Wait for the AI to finish its response, then click “Copy” again—this time it works.

Expected Behavior:
The “Copy” button should work at any point once the code block has begun rendering. Users shouldn’t have to wait for the entire answer to complete before copying.


Actual Behavior:
The “Copy” button only becomes active after the AI completes the full response and finalizes the code block.


Reproducibility:
Consistent – the copy button is unresponsive until the end of every streamed code response.


Additional Context:
This delay interrupts developer workflow when reviewing or reusing code as it is generated.


Possible Areas to Investigate:

  • Enable copy functionality on partially rendered code blocks
  • Decouple copy action from stream completion event
  • Update UI state as soon as any snippet content is available

Activity

  1. added
    chat-ext-issue
    on Jul 11, 2025
  2. added and removed
    chat-ext-issue
    on Jul 11, 2025
  3. added
    bug
    on Jul 31, 2025
  4. added this to the Backlog milestone on Jul 31, 2025
  5. added
    help wanted
    on Jul 31, 2025
  6. added a commit that references this issue on Oct 2, 2025
    bb035bd
  7. mjbvz commented on Oct 2, 2025

    @mjbvz
    Contributor

    This seems to be partially fixed in the latest insider builds. I was able to copy the code both while the whole response was streaming and while the individual code block was streaming in

    However the copy button flashes if you hover over it during streaming and doesn't always seem to copy correctly

  8. dmitrivMS commented on Dec 21, 2025

    @dmitrivMS
    Collaborator

    There are several issues here currently:

    1. The button flickers when hovering over it, then moving mouse over the snippet
    2. The button flickers when hovering over it, then over its tooltip, the back to snippet
    3. The actual "Copy" functionality does not work until streaming is complete
  9. dmitrivMS commented on Dec 21, 2025

    @dmitrivMS
    Collaborator

    The root cause appears to be the fact that codeBlockParts are being reset and reinitialized during streaming causing toolbar to be recreated - hence the flickering and actions not working. One solution is to reuse codeBlockParts that are unchanged, but that's a large change... Matt Bierner (@mjbvz) FYI

  10. 2 remaining items

  11. modified the milestones: Backlog, 1.116.0 on Apr 7, 2026
  12. added
    unreleased
    insiders-released
    and removed
    unreleased
    on Apr 7, 2026
  13. bryanchen-d commented on Apr 13, 2026

    @bryanchen-d
    Collaborator

    Dmitriy Vasyura (@dmitrivMS) , do you have steps to verify the component while streaming? the original steps from the issue are not working since the js files are generated into files directly and I don't get a chance to see it streaming.

  14. added
    verification-steps-needed
    on Apr 13, 2026
  15. bryanchen-d commented on Apr 13, 2026

    @bryanchen-d
    Collaborator

    verified by asking for "generate a long code block"

  16. added
    verified
    and removed
    verification-steps-needed
    on Apr 13, 2026
  17. locked and limited conversation to collaborators on May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughelp wantedinsiders-releasedpanel-chatverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions