Skip to content

lsp: Where to put errors of imported files? #998

Description

@flofriday

While reviewing the recent LSP PR we came across this issue (here is my comment).

At the moment we put all the errors of the importee (files we import) also in the importer (current file), at the position of the first character in the file.
In practise I think this reads poorly:

Screenshot from IDE:

Image

In most cases the importer isn't responsible for such errors and as such I don't think they need to be shown in the importer.

Nuances in OpenVADL:
However, you can break a file by they way you import it. In that case the importee is correct on it's own but by how you imported it is no longer valid:

Image

While this is possible it 1) is not that common, I had to think quite hard to come up with an example that behaves like that and 2) the error shown still doesn't really help the user and they still have to invoke the compiler by hand.

Suggestion:
I think, we should only show the errors in the files we are in. In the obscure cases that the importer brakes the importee I think it will be fine if only a actual compilation will show that.

This is also what other LSPs do like rusts amazing rust-analyzer:

Image

@AndreasKrall do you have any thoughts on this.

Metadata

Metadata

Labels

lspLanguage Server Protocol related

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions