8000 Line:Column in error message when `parse_all` fails · Issue #30 · fleabitdev/glsp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Line:Column in error message when parse_all fails #30

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

Open
Fahien opened this issue Jan 23, 2021 · 1 comment
Open

Line:Column in error message when parse_all fails #30

Fahien opened this issue Jan 23, 2021 · 1 comment

Comments

@Fahien
Copy link
Fahien commented Jan 23, 2021

I am experimenting with a language server extension and I am trying to highlight areas of the code that fail to parse. I am not sure if my approach is the best or even correct.

At the moment I am calling parse_all(&code, None), and I am inspecting the error value. Unfortunately I can only get a message, with no information about line and column (or span) where the error is.

@fleabitdev
Copy link
Owner

Thanks for your interest!

Line-and-column information is currently destroyed (converted to text) when constructing a GError. There's no easy way to access it programmatically. As a workaround, you could capture a short-form error string with glsp::try_call, and then parse line-and-column information from that string.

There's no reason we couldn't expose an API for this, but I have to admit that it's a low-priority feature. I might tackle it when I'm working on stack-frame inspection (issue #8).

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

2 participants
0