A fancy compiler diagnostics crate.
examples/ for more examples.
ariadne is a sister project of
chumsky. Neither are dependent on
one-another, but I’m working on both simultaneously and like to think that their features compliment each other. If
you’re thinking of using
ariadne to process your compiler’s output, why not try using
chumsky to process its input?
- Inline and multi-line labels capable of handling arbitrary configurations of spans
- Multi-file errors
- Generic across custom spans and file caches
- A choice of character sets to ensure compatibility
- Coloured labels & highlighting with 8-bit and 24-bit color support (thanks to
- Label priority and ordering
- Compact mode for smaller diagnostics
- Correct handling of variable-width characters such as tabs
ColorGeneratortype that generates distinct colours for visual elements.
- A plethora of other options (tab width, label attach points, underlines, etc.)
- Built-in ordering/overlap heuristics that come up with the best way to avoid overlapping & label crossover
- Improved layout planning & space usage
- Non-ANSI terminal support
- More accessibility options (screenreader-friendly mode, textured highlighting as an alternative to color, etc.)
- More color options
- Better support for layout restrictions (maximum terminal width, for example)
The API (should) follow semver. However, this does not apply to the layout of final error messages. Minor tweaks to the internal layout heuristics can often result in the exact format of error messages changing with labels moving slightly. If you experience a change in layout that you believe to be a regression (either the change is incorrect, or makes your diagnostics harder to read) then please open an issue.
@brendanzabfor their beautiful
codespancrate that inspired me to try pushing the envelope of error diagnostics.
@estebankfor showing innumerable people just how good compiler diagnostics can be through their work on Rust.
A type that can generate distinct 8-bit colors.
A type used to configure a report
A type that represents a labelled section of source code.
A type representing a diagnostic that is ready to be written to output.
Possible character sets to use when rendering diagnostics.
An enum representing an ANSI color code.
The attachment point of inline label arrows
A type that defines the kind of report being produced.
A trait used to add formatting attributes to displayable items.
A trait implemented by spans within a character-based source.