Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: control context lines around labels #127

Open
OmarTawfik opened this issue Aug 23, 2024 · 3 comments
Open

feature request: control context lines around labels #127

OmarTawfik opened this issue Aug 23, 2024 · 3 comments

Comments

@OmarTawfik
Copy link

Thanks for the really useful crate!

We wanted to suggest a tiny addition to the API, to control/increase the number of context lines around a label. It would make the hint much more readable, and doesn't force the user to click/navigate to the file to figure out the context around it.

For example, this is a typical label shown on line 5:

   ╭─[input.sol:5:5]
   │
 5 │     return r;
   │            ┬  
   │            ╰── some hint text.
───╯

But if user sets Label::with_context_lines(2) (defaults to zero), it will show 2 more lines in both directions around line 5 (above and below):

   ╭─[input.sol:5:5]
   │
 3 │     // fetch result from server:
 4 │     int r = fetchResult();
 5 │     return r;
   │            ┬  
   │            ╰── some hint text.
 6 │   }
 7 │ }
───╯

Or as an improvement, it can also support specific directions, with Label::with_context_lines_above(2) and Label::with_context_lines_below(2) .

Thanks!

@fogzot
Copy link

fogzot commented Sep 2, 2024

This would make some diagnostic messages (especially ones where white space is not important and the user can do as they please) a more informative and easier to understand.

@zesterer
Copy link
Owner

zesterer commented Sep 2, 2024

Configurable context is something I plan to add to ariadne's rewrite (you can see the ariadne2 branch for current progress, if you're curious).

@OmarTawfik
Copy link
Author

Thanks @zesterer!
Is there a timeline for shipping v2? Otherwise, I wonder how much work is it to add to v1? any tips?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants