Stream: contributing

Topic: Language server shows some errors at line 0


view this post on Zulip mkrieger1 (Dec 31 2023 at 18:33):

Since I've started using the language server a few days ago I noticed that some diagnostics are shown at the top of the file (the sent JSON contains range = { ... line = 0 ...}) although the precise location of the error is known and the corresponding code snippet is shown in the error message.

For example this happens with "unfinished type" errors.

Is this already a known issue or should I try to make a reproducible example and create one?

view this post on Zulip mkrieger1 (Dec 31 2023 at 18:36):

I think some of the relevant code is here, but I did not see an obvious cause for this. Maybe some .unwrap_or_else(Region::zero) is hit?

view this post on Zulip mkrieger1 (Dec 31 2023 at 18:47):

Other errors for which this happens are: "missing arrow", "unfinished function", "unknown operator", "not end of file".

view this post on Zulip Eli Dowling (Jan 01 2024 at 14:19):

It's any error where the document cannot be parsed.
I'd suggest making an issue to track this. It's a known issue to me, but it's not something I worry much about because the real bug is that the parser will just completely fail if it encounters code that is totally invalid structurally.

That said, recoverable parsing isn't a feature I expect anyone soon, and this might be an easy fix.


Last updated: Jul 05 2025 at 12:14 UTC