nix-community / vscode-nix-ide

Nix language support for VSCode editor [maintainer: @jnoortheen]
https://marketplace.visualstudio.com/items?itemName=jnoortheen.nix-ide
MIT License
310 stars 23 forks source link

spawn nix-instantiate ENOENT #428

Open andrewbaxter opened 2 weeks ago

andrewbaxter commented 2 weeks ago

Same as #404 (closed).

I just installed the plugin and immediately got spawn nix-instantiate ENOENT when I opened a .nix file. I installed nixd per @inclyc 's link in #404 and the error message went away. I don't have any settings set, like "nix.enableLanguageServer": true,.

The presence of an error message popup I believe unambiguously means that the plugin expected something to work and it failed unexpectedly, and notified the user because it might (again, unexpectedly) impact their usage.

I'm not sure I 100% understand the discussion in #404. Can someone confirm my summary?

So I think either

  1. A language server is required, and the installation section of the Nix IDE should be updated to reflect this

  2. A language server shouldn't be required, and there's some bug in the plugin that's not checking for its presence

If it's 1 (and FWIW I think it's reasonable to require an LSP, developer machines are powerful and it might simplify things) I'd be glad to make an MR.

I think a good use case is: A new person joins a company using Nix for images or whatever. They've just set up their computer and come across a Nix file in some repo, and go to the extensions marketplace for an extension and find Nix IDE. They've never used Nix before and don't have anything set up, so they read the extension readme to figure out what they need to do. They are neither using a Nix system nor are they using Nix as a package manager on a foreign distro currently (maybe they will eventually, but they're relying on CI for now).

Since extensions are often people's entry points to development ecosystems, in this case I think it wouldn't be crazy to list all requirements: Nix itself, LSP, plus the formatter? Just linking to their installation instructions, not duplicating anything.

Edit: Saving a file shows failed to run nixpkgs-fmt: spawn nixpkgs-fmt ENOENT and a popup about waiting for Nix IDE that lasts indefinitely so it seems like nixpkgs-fmt is non-optional too.