[FEATURE]: Add copy to clipboard functionality for outputted snippets of code #3598

Open
opened 2026-02-16 17:40:48 -05:00 by yindo · 8 comments
Owner

Originally created by @sohcfst on GitHub (Dec 16, 2025).

Originally assigned to: @rekram1-node on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Sometimes I have opencode (tui) generate sql for me to run in my local db gui, or code for me to just play with but the output can be pretty long. I have to zoom out a bunch to copy the snippet sometimes.

Maybe a dumb workflow! But I do it.

Also just posting here to put out a feeler, and maybe make my first contribution to open source that if there's any interest.

Love OC!

Cheers

Originally created by @sohcfst on GitHub (Dec 16, 2025). Originally assigned to: @rekram1-node on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request Sometimes I have opencode (tui) generate sql for me to run in my local db gui, or code for me to just play with but the output can be pretty long. I have to zoom out a bunch to copy the snippet sometimes. Maybe a dumb workflow! But I do it. Also just posting here to put out a feeler, and maybe make my first contribution to open source that if there's any interest. Love OC! Cheers
yindo added the opentuidiscussion labels 2026-02-16 17:40:48 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 16, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3527: [FEATURE]: Easier Access to Code Snippets Output - requests better access to code snippets, including copy functionality
  • #2118: Add a /copy command to copy latest message (or allow scrolling while selecting text) - proposes a /copy command for this purpose
  • #4885: [FEATURE]: Copy console text on click - requests copy functionality for text output

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 16, 2025): This issue might be a duplicate of existing issues. Please check: - #3527: [FEATURE]: Easier Access to Code Snippets Output - requests better access to code snippets, including copy functionality - #2118: Add a /copy command to copy latest message (or allow scrolling while selecting text) - proposes a /copy command for this purpose - #4885: [FEATURE]: Copy console text on click - requests copy functionality for text output Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Dec 16, 2025):

Someone had an idea where you could click a tool call and view it w/ more detail

Are you looking to copy code in markdown or like the actual code from an edit / write?

@rekram1-node commented on GitHub (Dec 16, 2025): Someone had an idea where you could click a tool call and view it w/ more detail Are you looking to copy code in markdown or like the actual code from an edit / write?
Author
Owner

@ariane-emory commented on GitHub (Dec 16, 2025):

@sohcfst This isn't exactly what you're looking for, but might be an acceptable second choice in the meantime: you can copy entire messages by clicking on them and selecting the Copy option in the modal that appears (which will not exactly align with your desired feature because any non-code content in the message will also be copied, you would have to edit that out yourself).

@ariane-emory commented on GitHub (Dec 16, 2025): @sohcfst This isn't _exactly_ what you're looking for, but might be an acceptable second choice in the meantime: you can copy entire messages by clicking on them and selecting the Copy option in the modal that appears (which will not _exactly_ align with your desired feature because any non-code content in the message will also be copied, you would have to edit that out yourself).
Author
Owner

@sohcfst commented on GitHub (Dec 17, 2025):

@ariane-emory hmm I tried, and I can right click and copy my own message, but not the code output. is right clicking + copy possible with responses?

@rekram1-node hmm personally I'm not interested in diving into tool calls but that sounds neat!

not from an edit or write, just generating snippets on the fly. i attached a pic of an example of something i might generate. sometimes i'll have to zoom out 500% to select and copy the text if it's way longer than the viewport

Image
@sohcfst commented on GitHub (Dec 17, 2025): @ariane-emory hmm I tried, and I can right click and copy my own message, but not the code output. is right clicking + copy possible with responses? @rekram1-node hmm personally I'm not interested in diving into tool calls but that sounds neat! not from an edit or write, just generating snippets on the fly. i attached a pic of an example of something i might generate. sometimes i'll have to zoom out 500% to select and copy the text if it's way longer than the viewport <img width="629" height="1013" alt="Image" src="https://github.com/user-attachments/assets/ec919ccb-56ff-4bca-8cbd-129cd05a7b87" />
Author
Owner

@ariane-emory commented on GitHub (Dec 17, 2025):

@sohcfst Geeze, you're correct. I must have spaced out and confused myself, my answer was absolutely wrong, sorry!

Now that I've un-confused myself, I do think that having similar copy-on-click functionality to user messages on the agent/tool messages does sound like it could be useful.

@ariane-emory commented on GitHub (Dec 17, 2025): @sohcfst Geeze, you're correct. I must have spaced out and confused myself, my answer was absolutely wrong, sorry! Now that I've un-confused myself, I do think that having similar copy-on-click functionality to user messages on the agent/tool messages does sound like it could be useful.
Author
Owner

@sohcfst commented on GitHub (Dec 19, 2025):

@ariane-emory no worries! what happened with your PR? saw you attempted?

@sohcfst commented on GitHub (Dec 19, 2025): @ariane-emory no worries! what happened with your PR? saw you attempted?
Author
Owner

@ariane-emory commented on GitHub (Dec 19, 2025):

@sohcfst Sorry, I'd gotten distracted by looking at other things.... also, I realizes that messages_copy already covered most cases (it does only copy the last agent message, but most of the time that's the one that the user would want to copy).

@ariane-emory commented on GitHub (Dec 19, 2025): @sohcfst Sorry, I'd gotten distracted by looking at other things.... also, I realizes that `messages_copy` already covered most cases (it does only copy the _last_ agent message, but most of the time that's the one that the user would want to copy).
Author
Owner

@ariane-emory commented on GitHub (Dec 19, 2025):

@sohcfst Oh, that was just a dummy PR on my personal fork (not on sst/opencode) of a WIP that didn't successfully resolve the issue.

@ariane-emory commented on GitHub (Dec 19, 2025): @sohcfst Oh, that was just a dummy PR on my personal fork (not on sst/opencode) of a WIP that didn't successfully resolve the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3598