Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserve colors in diagnostics #1117

Open
jyn514 opened this issue Nov 8, 2024 · 4 comments
Open

preserve colors in diagnostics #1117

jyn514 opened this issue Nov 8, 2024 · 4 comments

Comments

@jyn514
Copy link
Member

jyn514 commented Nov 8, 2024

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: Image

it would be nice if playground preserved the colors.

repro here

@estebank
Copy link

estebank commented Nov 8, 2024

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.

@shepmaster
Copy link
Member

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?

@estebank
Copy link

estebank commented Nov 8, 2024

@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.

@jyn514
Copy link
Member Author

jyn514 commented Nov 8, 2024

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: rust-lang/rust#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.

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

No branches or pull requests

3 participants