vscode-nix-ide
vscode-nix-ide copied to clipboard
Empty files causing LS to throw errors
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.
This is fixed in nixd 2.2.2
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)
Yes, that's partially fixed (in 2.2.2), you can see the release notes.
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.