ariadne icon indicating copy to clipboard operation
ariadne copied to clipboard

Tracking: The Big Refactor

Open zesterer opened this issue 1 year ago • 6 comments

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!

zesterer avatar Jan 01 '24 17:01 zesterer

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

CreatorSiSo avatar Jan 02 '24 04:01 CreatorSiSo

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.

CorvusPrudens avatar Jan 06 '24 03:01 CorvusPrudens

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).

calder avatar Jan 07 '24 17:01 calder

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.

zesterer avatar Apr 25 '24 19:04 zesterer

Keep up the good work! Looking forward to seeing the new release.

toadslop avatar May 12 '24 06:05 toadslop