Skip to content

Freed-Wu/coc-nix

 
 

Repository files navigation

Nix IDE ✨💡🌟

Adds Nix language support for Visual Studio Code.

Installation 🔨

Available on both the Visual Studio Marketplace and the Open VSX Registry.

You can also open the Command Palette (Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on macOS) and enter ext install jnoortheen.nix-ide to install the extension, or download it from the latest release.

Quickstart 🚀

  1. Install the extension
  2. Open a Nix file
  3. Syntax highlighting should work out of the box.
  4. Formatting the code should work if nixpkgs-fmt is installed and available on the PATH.
  5. Full language support is available if you have a language server installed and enabled. See LSP Plugin Support for more information.

Features 🎯

Settings ⚙️

Custom Formatter

It can be changed by setting nix.formatterPath to any command which can accept file contents on stdin and return formatted text on stdout.

{ 
    "nix.formatterPath": "nixpkgs-fmt" // or "nixfmt" or ["treefmt", "--stdin", "{file}"]
    // or using flakes with `formatter = pkgs.alejandra;`
    // "nix.formatterPath": ["nix", "fmt", "--", "--"]
}

LSP Plugin Support

Full language support can be enabled by using a language server. Generally, any Nix LSP implementation should work.

{
  "nix.enableLanguageServer": true,
  "nix.serverPath": "nil", // or "nixd"
  // Pass settings to the language server via the `serverSettings` option.
  "nix.serverSettings": { ... }
}

Some examples of advanced settings are provided below for nil and nixd.

Contributing 💪

We welcome contributions to this extension. Kindly start with any of open issues or feature requests.

See CONTRIBUTING.md for more information.

Credits

Special thanks to:

About

Port vscode-nix-ide to vim [maintainer: @Freed-Wu]

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.5%
  • Nix 1.7%
  • Other 0.8%