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

Empty files causing LS to throw errors #393

Open
Munsio opened this issue Jun 1, 2024 · 4 comments
Open

Empty files causing LS to throw errors #393

Munsio opened this issue Jun 1, 2024 · 4 comments

Comments

@Munsio
Copy link

Munsio commented Jun 1, 2024

Hey running the extension with nixd LS and when I open an empty .nix file I always get a lot of errors inside VSCode because the LS is unable to generate the AST from the file.

Technically it is a valid error from LS but it is very annoying inside VSCode, so I would suggest to suppress this particular error if the file content is empty.

On the other hand if there is a configuration to avoid this behavior, then I would suggest to put it into a "possible default" documentation section or similar.

Error message:

I[12:28:37.526] 2177: <-- textDocument/codeAction(857)
I[12:28:37.526] 2177: --> reply:textDocument/codeAction(857)
I[12:28:37.544] 2177: <-- textDocument/documentLink(858)
I[12:28:37.544] 2177: --> reply:textDocument/documentLink(858) AST is null on this unit, error: 3
I[12:28:37.544] 2177: <-- textDocument/inlayHint(859)
I[12:28:37.544] 2177: --> reply:textDocument/inlayHint(859) AST is null on this unit, error: 3
[Error - 12:28:37 PM] Request textDocument/documentLink failed.
  Message: AST is null on this unit
  Code: -32001 
[Error - 12:28:37 PM] Request textDocument/inlayHint failed.
  Message: AST is null on this unit
  Code: -32001 
I[12:28:37.823] 2177: <-- textDocument/semanticTokens/full(860)
I[12:28:37.823] 2177: --> reply:textDocument/semanticTokens/full(860) AST is null on this unit, error: 3
[Error - 12:28:37 PM] Request textDocument/semanticTokens/full failed.
  Message: AST is null on this unit
  Code: -32001 
I[12:28:37.830] 2177: <-- textDocument/documentSymbol(861)
I[12:28:37.830] 2177: --> reply:textDocument/documentSymbol(861) AST is null on this unit, error: 3
[Error - 12:28:37 PM] Request textDocument/documentSymbol failed.
  Message: AST is null on this unit
  Code: -32001 

If you need anything else just ask and I try to provide all the information needed.

@inclyc
Copy link
Member

inclyc commented Jun 23, 2024

This is fixed in nixd 2.2.2

@DylanBulfin
Copy link

Could be something with my configuration since I'm pretty new to nix(OS), but I'm still seeing the same behavior with nixd 2.2.2 and nix-ide 0.3.1 (both from nixpkgs-unstable)

@inclyc
Copy link
Member

inclyc commented Jul 10, 2024

Yes, that's partially fixed (in 2.2.2), you can see the release notes.

@myned
Copy link

myned commented Jul 17, 2024

From the 2.2.2 release notes:

null AST is still emitting errors. Should be fixed in the next release.

It should be fixed in nixd 2.2.3.

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

4 participants