rust-playground
rust-playground copied to clipboard
preserve colors in diagnostics
rustc uses a lot of colors and highlighting in its errors. sometimes the output is hard to read when those are removed. consider for example this diagnostic, where it's hard to parse that the - is meant to be a highlight:
it would be nice if playground preserved the colors.
repro here
It might be enough to use anstyle-svg for this, but that would require additional work for the existing links. A likely better option would be to have the json output emit the colored ANSI output and use some other crate to turn the codes into HTML that we can style.
rustc uses a lot of colors and highlighting in its errors. sometimes the output is hard to read when those are removed
Should that be a general concern for people who don’t have colors for whatever given reason?
@shepmaster I make an effort to make sure that all output is readable as text only, but undoubtedly color makes the output easier to scan and reduces the likelihood of misreading things. In the screenshot, someone very knowledgeable mistook the - as a connector between the ^^ and help.... With colors, the help appears blue, like the -, making it easier to differentiate from the ^^. That being said, this suggestion in particular is also being changed to be verbose style so that we no longer have this confusion. I want us to move away from inline suggestions entirely (but that requires me building a PR while --blessing stderr files for every platform, which is a bit of a pain), but that will still leave some corner cases where non-suggestion short labels can be misread slightly.
Should that be a general concern for people who don’t have colors for whatever given reason?
note that this particular case is being fixed upstream in rustc: https://github.com/rust-lang/rust/pull/132780
but it would be nice to fix it in the general case as well; it's never going to be possible to communicate as much information as visibly with text alone.
I tried some time back making all suggestions have the verbose diff output in https://github.com/rust-lang/rust/pull/127282. Landing that change or one like it will be a huge pain in the neck.