ariadne
ariadne copied to clipboard
Allow annotation with different styles
What I want to achieve:
Currently, there's only a way to underline some text with fancy utf-8 underscores.
I want something similar to this:
error[E0061]: this function takes 1 argument but 3 arguments were supplied
--> src/main.rs:2:5
|
2 | std::mem::transmute(3, 3, 4);
| ^^^^^^^^^^^^^^^^^^^ - - unexpected argument of type `{integer}`
| |
| unexpected argument of type `{integer}`
A possible way to achieve that:
My thought would be adding a with_style option to a Label and maybe restrict those to Underscore, Wiggly and Spiky (just making up names), where Underscore would be the default, Wiggly would use ~ and Spiky ^.
One thing to note would be, that those notation shouldn't be allowed to have a message associated with them?
What do you think?
I would like to see this, and I hope the eventual refactor will cover this use-case!
I'm curious about the rewrite. Do you have anything particular in mind or anything done yet?
I'm not sure, but I'd like to help, cause I really like this library! <3
I've unfortunately not made much progress. Most of Ariadne was written over a single night in a sort of fugue state some time ago. Needless to say, the internals reflect that. There are a few main goals I have for the rewrite:
- Made the code more modular, easier to understand, and easy to extend
- Support more advanced layouting options
- Rewrite the
Cache/Sourcesystem to be more efficient, to generalise better, and generally be less of a nuisance. - Use byte offsets instead of character offsets by default (with an option to convert the latter to the former)
- Figure out how to do colour and other formatting 'properly'. Right now we just assume that labels are strings and have text formatting be applied with ANSI escape codes by the user. The problem with this is that we can't easily do anything to customise that formatting because it happens before we have access to it. The best we can do is to strip it out with an ANSI stripper, but that's not particularly useful
I have some initial thoughts about the best approach for this.
I'm thinking that a good strategy would be to create a type-directed API that behaves sort of like a DOM, but specifically geared toward displaying error diagnostics.
That way, users can specify content and themeing independently of one-another and Ariadne turns into a sort of glorified document rendering engine. It would also allow for more 'alien' output formats: Ariadne could render diagnostics as HTML, JSON (for LSP), or any number of other formats.
As with most of these things, I tend to go through long periods of inactivity and then have a single night of hyperfocus and everything suddenly comes together. I'm hoping inspiration will strike me soon. Thanks for your comment, it's forced me to put some of my thoughts into words and now I'm thinking about it again!
Edit: I just noticed that you're interesting in helping. I'd really appreciate that! I've always found that collaborating with people is a great way to get my head to switch on and start doing stuff. Did you have any thoughts on all this?