zesterer / ariadne

A fancy diagnostics & error reporting crate
https://crates.io/crates/ariadne
MIT License
1.61k stars 72 forks source link

Adding more styling options for users #108

Open snowfoxsh opened 3 months ago

snowfoxsh commented 3 months ago

Abstract

This pull request introduces the capability to use straight box drawing characters in addition to the existing curved ones. This enhancement broadens the range of visual styles available to users, allowing for greater flexibility and customization in graphical representations.

Background

Currently, our system supports only curved box drawing characters. While these are suitable for many applications, they can sometimes appear too stylized for use cases requiring a sharper, more angular aesthetic. Recognizing this limitation, this update provides an alternative that caters to different stylistic preferences and practical requirements.

Implementation Details

The implementation extends the existing functionality to include straight line variants of the box drawing characters. This is achieved by adding a new enumeration option, CharSet::UnicodeStraight, which users can select to switch from curved to straight line rendering. This option is designed to integrate seamlessly with the existing framework, ensuring that users can easily toggle between character styles without compatibility issues.

Also Includes

Impact

By enabling the use of straight box drawing characters, this feature enhances the toolkit available to users, making it more adaptable to various design needs. It particularly benefits applications in design, text-based art, and user interface development, where line aesthetics can play a crucial role in user experience and information clarity.

Example

Error: can't compare apples with oranges
   ┌─[<unknown>:1:1]
   │
 1 │ apple == orange;
   │ ──┬──    ───┬──  
   │   └────────────── This is an apple
   │             │    
   │             └──── This is an orange
───┘
snowfoxsh commented 3 months ago

Enhancing Styling Flexibility

Our current styling system, while functional, is limited. This approach, though practical for general applications, limits users who seek finer control over their styling preferences. To address this, I propose a more versatile styling mechanism. This would involve an optional builder pattern that allows users to customize styles by selectively overriding character sets at both the category and individual character levels. I would be happy to develop a prototype and further outline the potential interface. What do you think? I am ready to provide more details upon your interest.

snowfoxsh commented 3 months ago

Ur working on a refactor? Cool. I have some time on my hands if you would like me to add some contributions.

Also, on a side note how do you feel about a source code manipulation "Label" objects. For instance, if you want to prompt your reader to add something you could add an Insertion that would alter the source to reflect the change? The advantage of doing something like is that spans would be automatically calculated. You could just span as normal and let the report handle stuff for you.

snowfoxsh commented 3 months ago

I have got an interface mostly complete for insertion, i can make a pull soon if interested. I think it should be relatively easy to place behind a feature flag

zesterer commented 3 months ago

Ur working on a refactor? Cool. I have some time on my hands if you would like me to add some contributions.

My current progress is on the ariadne2 branch. It's a total rewrite with the intention of having the code be a lot easier to work with, customise, support for multiple output backends, etc. Still very WIP though, only started work on it over the past week.

Also, on a side note how do you feel about a source code manipulation "Label" objects.

Very positive! It's definitely planned for the refactor. I've not started implementing it yet, but my goal is to allow for the 'embellishment' of Sources (in the refactor, called Files), allowing you to compose insertions/removals on top of them and have Ariadne automatically compensate for offsets in a fairly seamless manner.

I have got an interface mostly complete for insertion, i can make a pull soon if interested.

I'd be interested to see how it compares with my own ideas about this for sure!

snowfoxsh commented 3 months ago

I'd be interested to see how it compares with my own ideas about this for sure!

Okay, ill make a pr into stable when im done with the feature so you can check it out.

My current progress is on the ariadne2 branch. It's a total rewrite with the intention of having the code be a lot easier to work with, customize, support for multiple output backends, etc. Still very WIP though, only started work on it over the past week.

Nice Nice. Ill check it out and see if I can help in the next week ish.

snowfoxsh commented 3 months ago

Missclick 💀