annotate-snippets-rs
annotate-snippets-rs copied to clipboard
Library for snippet annotations
This is split out of https://github.com/rust-lang/annotate-snippets-rs/issues/13#issuecomment-543321203 > FormattedSnippet is public for alternate renderers to use, such as ones that want to use box drawing characters. The layout work is done...
This is split out of https://github.com/rust-lang/annotate-snippets-rs/issues/13#issuecomment-543321203 > Input text doesn't have to be &str; it can be anything that can implement Display. This is especially useful when the origin source...
Currently, sub-diagnostics are handled by adding [`Annotation`'s](https://github.com/rust-lang/annotate-snippets-rs/blob/027c95b74cb74c1c5880a7d316abcbd743190260/src/snippet.rs#L80) to [`Snippet::footer`](https://github.com/rust-lang/annotate-snippets-rs/blob/027c95b74cb74c1c5880a7d316abcbd743190260/src/snippet.rs#L38). This system is _fine_, but it does not support sub-diagnostics with a span. This is needed for `rust` adoption as [`Subdiag`](https://github.com/rust-lang/rust/blob/5257aee7dd163d21d32fa904578d4fb0f4c91b79/compiler/rustc_errors/src/diagnostic.rs#L470-L477)...
Currently, there is no way to emit a [suggestion](https://rustc-dev-guide.rust-lang.org/diagnostics.html#suggestions) about some source in the same style as [`rustc_errors`](https://github.com/rust-lang/rust/blob/5257aee7dd163d21d32fa904578d4fb0f4c91b79/compiler/rustc_errors/src/emitter.rs#L1707-L1707). We will need to support [additions/removals](https://github.com/rust-lang/rust/blob/5257aee7dd163d21d32fa904578d4fb0f4c91b79/compiler/rustc_errors/src/emitter.rs#L1784-L1802) for this to work. These could...
Currently, an `Annotation` is created with a `Level`. We emulate rustc's "context" style by using a `Level::Info` but this isn't accurate (and adds a prefix).
fix #57
Have the documentation for `Level` reflect actual appearance. --- The output from this file: (43 lines) ```rust //! Provides a user-friendly error if the given file has the string `tab`...
As I was trying to understand #109, #110, I took the opportunity to add unit tests. I hope I'm on the right way. ## References - #109 - #110
Hi, I found out this description confused me at the first moment. I wonder if I can clarify it like this?