mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
crates: vendor annotate-snippets
crate
This merely adds the crate to our repository. Some cosmetic changes are made to make it work in our repo and follow our conventions, such as changing the name to `ruff_annotate_snippets`. We retain the original license information. We do drop some things, such as benchmarks, but keep tests and examples.
This commit is contained in:
parent
4f3209a3ec
commit
9c27c57b5b
58 changed files with 6171 additions and 8 deletions
19
crates/ruff_annotate_snippets/examples/multislice.rs
Normal file
19
crates/ruff_annotate_snippets/examples/multislice.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use ruff_annotate_snippets::{Level, Renderer, Snippet};
|
||||
|
||||
fn main() {
|
||||
let message = Level::Error
|
||||
.title("mismatched types")
|
||||
.snippet(
|
||||
Snippet::source("Foo")
|
||||
.line_start(51)
|
||||
.origin("src/format.rs"),
|
||||
)
|
||||
.snippet(
|
||||
Snippet::source("Faa")
|
||||
.line_start(129)
|
||||
.origin("src/display.rs"),
|
||||
);
|
||||
|
||||
let renderer = Renderer::styled();
|
||||
anstream::println!("{}", renderer.render(message));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue