-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Get Diagnostic Line Number #112
Comments
The structure of a |
@Stupremee so what field should I access? |
Or do I have to manually calculate line number? |
Yes most likely. Depending on the suggestion and what line number do you want. |
If you see an error message with an error, and help / info stuff, then there are multiple child diagnostics |
@Stupremee isn't this an essential diagnostic field however? Wouldn't you think it's hard to manually calculate? |
Also - not to forget, it's expensive to do this every time you need a line number - it's so much easier if we could get a |
Wait nvm. Yea you need to calculate the line number |
Yes, that gives me character range, not line number though 😅 |
Also 1 more question - the primary error message i get for the first post here is correct (something along the lines of expected |
You can take a look into line_starts
.binary_search(&byte_index)
.unwrap_or_else(|next_line| next_line - 1), You can even do this automatically using |
IIRC we don't suggest any fixes for any parsing errors. Might be a good addition, but is also very hard to do correctly |
agreed |
Do you have discord or something else? Using github issues for stuff like this is annoying 😅 |
Yes - |
So I was wondering if there way any way to get the line number of the error (which line the error occured in).
Nodejs shows you the error like so:
So i was wondering if there was any field in
Diagnostic
that gives you the line number.The text was updated successfully, but these errors were encountered: