rust-playground icon indicating copy to clipboard operation
rust-playground copied to clipboard

Make stderr output more copy-friendly

Open estebank opened this issue 3 years ago • 5 comments

When copying the stderr output from the compiler, it seems the clipboard now contains markdown for the link around error codes in the main message (or maybe it's HTML and pasting in GH turns it into markdown). This is causing unnecessarily verbose output in reports. I believe that in most cases people desire just the textual representation of errors, the link structure being either redundant or unnecessary. I would love it if we could capture the on copy event and only push the bare textual output to the clipboard.

estebank avatar Sep 06 '22 13:09 estebank

Yes, this is the browser / GitHub doing it. For example:

2022-09-06 10 45 33

I don't particularly relish attempting to subvert how the OS / browser / GitHub perform core functionality such as copy and paste...

shepmaster avatar Sep 06 '22 14:09 shepmaster

unnecessarily verbose output in reports

I did try to help with that case but was requested to stop.

shepmaster avatar Sep 06 '22 14:09 shepmaster

desire just the textual representation of errors

This can be done by the user by using "Paste and Match Style" or the equivalent browser / OS options.

shepmaster avatar Sep 06 '22 14:09 shepmaster

I agree that this is a case of "the browser and GH being too smart by half", but I'm seeing the effects it's having on our tickets. Sadly any solution that relies on users being proactive will never have perfect compliance.

I did try to help with that case but was https://github.com/integer32llc/rust-playground/issues/671.

That seems to be related but not quite the same thing I was thinking of when I opened this. People that file issues will link to the playground and manually copy paste things. To be honest, I haven't seen the spammy tickets originated in the playground :)

estebank avatar Sep 06 '22 19:09 estebank

I was curious to see some examples of this problem and searched the Rust issues list:

https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+%22https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Ferror-index.html%22

A small handful:

https://github.com/rust-lang/rust/issues/101972 https://github.com/rust-lang/rust/issues/101880 https://github.com/rust-lang/rust/issues/101823

Interestingly, even though the filename/line combos (e.g. src/main.rs:9) are hyperlinks in the stderr output, they don't get Markdown-ified when pasted into issues. I suspect that's because they have href="#" and are handled by JavaScript. That suggests one strategy for handling the E0554 links and copy-paste: make them href="#" as well, and handle clicks using JavaScript rather than generating them as hyperlinks direct to their target.

jsha avatar Sep 22 '22 03:09 jsha