oxalica / nil

NIx Language server, an incremental analysis assistant for writing in Nix.
Apache License 2.0
1.38k stars 40 forks source link

Mistake in syntax highlighting #28

Closed DavHau closed 1 year ago

DavHau commented 1 year ago

In the end of the following file, red curly brackets appear, but the file is valid: https://github.com/nix-community/dream2nix/blob/e98ca58528f9b4d1fa8cc3135c02c4306ec81364/src/subsystems/python/builders/simple-python/default.nix

oxalica commented 1 year ago

Please provide your editor name, plugins and settings.

nil doesn't provide syntax highlighting. We only provides semantic tokens (if you enable it), and the coloring is done by your editor theme.

DavHau commented 1 year ago

I set it up with vscode like pointed out in the readme using the nix-ide plugin with settings:

{
  // ...
  "nix.enableLanguageServer": true, // Enable LSP.
  "nix.serverPath": "nil" // The path to the LSP server executable.
}

This is what is shown in the editor (red usually means syntax error, but there is none): image

oxalica commented 1 year ago

Cannot reproduce. Could you provide the output of your nil --version? Please ensure both nil and Nix IDE plugin are on their latest versions. If you have other plugins or theme installed, also try to disable them.

image

DavHau commented 1 year ago

nil 2022-11-10 a13e89c nix-ide v0.2.1

DavHau commented 1 year ago

Something might be wrong. If I type something completely invalid into nix.serverPath, it complains about not finding the server, but still highlights the code with the same broken patterns. So I guess it just defaults to some other server and does that even when I configure it to use nil.

DavHau commented 1 year ago

OK, now it works. It was some issue with managing vscode declaratively, but having programs.vscode.mutableExtensionsDir = true. The state shown in my vscode extensions GUI was not representing reality. Now, after disabling mutableExtensionsDir, everything works as expected.

Sorry for wasting your time on this. At least this might be useful for others having the same issue.