#ascii #analysis #error #code

annotate-snippets

Format diagnostic reports, including highlighting snippets of text

36 releases

0.12.10 Dec 1, 2025
0.12.9 Nov 15, 2025
0.12.8 Oct 28, 2025
0.11.5 Dec 9, 2024
0.1.0 May 22, 2018

#32 in Command-line interface

Download history 247536/week @ 2025-08-26 293239/week @ 2025-09-02 301213/week @ 2025-09-09 268573/week @ 2025-09-16 289650/week @ 2025-09-23 296653/week @ 2025-09-30 274621/week @ 2025-10-07 290086/week @ 2025-10-14 289223/week @ 2025-10-21 312339/week @ 2025-10-28 297079/week @ 2025-11-04 263494/week @ 2025-11-11 383608/week @ 2025-11-18 316876/week @ 2025-11-25 338800/week @ 2025-12-02 325657/week @ 2025-12-09

1,413,571 downloads per month
Used in 401 crates (84 directly)

MIT/Apache

195KB
3.5K SLoC

Format [diagnostic reports][Report], including highlighting snippets of text

Example

Visual overview

Report

Primary group

Title

error: cannot construct `Box<_, _>` with struct literal syntax due to private fields

Annotation on a Snippet

   ╭▸ $DIR/multi-suggestion.rs:17:13
   │
17 │     let _ = Box {};
   │             ━━━
   │

Message

   ╰ note: private fields `0` and `1` that were not provided

Secondary group: suggested fix

Title (proposed solution)

help: you might have meant to use an associated function to build this type

Patch Option 1 on a Snippet

   ╭╴
21 -     let _ = Box {};
21 +     let _ = Box::new(_);
   ├╴

Patch Option 2 on a Snippet

   ├╴
17 -     let _ = Box {};
17 +     let _ = Box::new_uninit();
   ├╴

etc for Options 3 and 4

Message

   ╰ and 12 other candidates

Secondary group: alternative suggested fix

Title (proposed solution)

help: consider using the `Default` trait

Only Patch on a Snippet

   ╭╴
17 -     let _ = Box {};
17 +     let _ = <Box as std::default::Default>::default();
   ╰╴

Cargo features

  • simd - Speeds up folding

  • testing-colors - Makes Renderer::styled colors OS independent, which allows for easier testing when testing colored output. It should be added as a feature in [dev-dependencies], which can be done with the following command:

cargo add annotate-snippets --dev --feature testing-colors

annotate-snippets

Format diagnostic reports, including highlighting snippets of text

crates.io documentation build status

Screenshot

License

Licensed under either of

at your option.

Dependencies

~1.5MB
~24K SLoC