ariadne
ariadne copied to clipboard
Tracking: The Big Refactor
I think it's clear that Ariadne has been successful in several domains, particularly the hobby langdev space. However, it has several limitations that a rewrite/refactor should address:
- No support for toggling colour on-and-off
- ANSI support is assumed, despite this assumption being unreasonable
- There are very few ways to customise the output (such as label ordering, for example)
- Terminal size can't be specified so label/note formatting is often broken
Additionally, there are some new features that a refactor could introduce:
- A generic DOM-like AST for reports (created using builder methods)
- More flexible structure with elements that can be arbitrarily nested
- Generic styling for elements
- Multiple backends (plaintext, ANSI, HTML, LSP JSON, etc.)
Comments welcome!
I did a tiny test implementation to try out the user facing api: https://github.com/CreatorSiSo/ariadne-next/blob/main/src/main.rs and how a specific backend would be implemented: https://github.com/CreatorSiSo/ariadne-next/blob/main/src/plaintext.rs
At the very least, providing an AST would make it a lot easier to translate ariadne reports to HTML (if HTML isn't made a first-class backend target), which is a use case I'm very interested in! Any HTML implementation would likely be fairly opinionated, so an AST might even be preferable.
One small thing that would be nice to fix: Cache::fetch returning references limits possible cache implementations (no RefCell for internally mutable caches for example).
As a point of interest, I've made some initial headway into this on the ariadne2 branch. It's very early days, but it's already capable of showing some basic diagnostics.
Keep up the good work! Looking forward to seeing the new release.