]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #13848 - ian-h-chamberlain:feature/color-compiler-diagnostics, r=ian...
authorbors <bors@rust-lang.org>
Mon, 9 Jan 2023 17:07:35 +0000 (17:07 +0000)
committerbors <bors@rust-lang.org>
Mon, 9 Jan 2023 17:07:35 +0000 (17:07 +0000)
Colorize `cargo check` diagnostics in VSCode via text decorations

Fixes #13648

![colored-rustc-diagnostics](https://user-images.githubusercontent.com/11131775/209479884-10eef8ca-37b4-4aae-88f7-3591ac01b25e.gif)

Use ANSI control characters to display text decorations matching the VScode terminal theme, and strip them out when providing text content for rustc diagnostics.

This adds the small [`anser`](https://www.npmjs.com/package/anser) library (MIT license, no dependencies) to parse the control codes, and it also supports HTML output so it should be fairly easy to switch to a rendered HTML/webview implementation in the future

I also updated the default `cargo check` command to use the rendered ANSI diagnostics, although I'm not sure if it makes sense to put this kind of thing behind a feature flag, or whether it might have any issues on Windows (as I believe ANSI codes are not used for colorization there)?


Trivial merge