Closed
Description
#!/usr/bin/env nargo
---
[dependencies]
annotate-snippets.git = "https://github.com/rust-lang/annotate-snippets-rs.git"
---
use annotate_snippets::{renderer::OutputTheme, AnnotationKind, Group, Level, Renderer, Snippet};
fn main() {
// Taken from: https://docs.python.org/3/library/typing.html#annotating-callable-objects
let source = "def __call__(self, *vals: bytes, maxlen: int | None = None) -> list[bytes]: ...";
let group = Group::with_title(Level::ERROR.title("")).element(
Snippet::source(source).annotation(AnnotationKind::Primary.span(4..12).label("annotation")),
);
println!(
"{}",
Renderer::styled()
.theme(OutputTheme::Unicode)
.term_width(83)
.render(&[group])
);
}