Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nix-community/vscode-nix-ide
Nix language support for VSCode editor [maintainer: @jnoortheen]
https://github.com/nix-community/vscode-nix-ide
nix nixos vscode vscode-extension
Last synced: 4 days ago
JSON representation
Nix language support for VSCode editor [maintainer: @jnoortheen]
- Host: GitHub
- URL: https://github.com/nix-community/vscode-nix-ide
- Owner: nix-community
- License: mit
- Created: 2020-07-12T23:06:57.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-02T04:59:13.000Z (18 days ago)
- Last Synced: 2025-02-15T06:34:12.615Z (5 days ago)
- Topics: nix, nixos, vscode, vscode-extension
- Language: TypeScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=jnoortheen.nix-ide
- Size: 1.31 MB
- Stars: 336
- Watchers: 6
- Forks: 27
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - nix-community/vscode-nix-ide - Nix language support for VSCode editor [maintainer: @jnoortheen] (TypeScript)
- awesome-starred - nix-community/vscode-nix-ide - Nix language support for VSCode editor [maintainer: @jnoortheen] (TypeScript)
README
# Nix IDE ✨💡🌟
Adds [Nix](https://nixos.org/) language support for [Visual Studio Code](https://code.visualstudio.com/).
## Installation 🔨
Available on both the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=jnoortheen.nix-ide) and the [Open VSX Registry](https://open-vsx.org/extension/jnoortheen/nix-ide).
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](https://github.com/nix-community/vscode-nix-ide/releases/latest).
## Quickstart 🚀
1. Install the extension, and Open a Nix file
1. Syntax highlighting should work out of the box.
1. Formatting the code should work if [`nixfmt`](https://github.com/NixOS/nixfmt) (or the archived [`nixpkgs-fmt`](https://github.com/nix-community/nixpkgs-fmt)) is installed and available on the `$PATH`.
1. Full language support is available if you have a language server installed and enabled. See [LSP Plugin Support](#lsp-plugin-support) for more information.## Features 🎯
- [Syntax Highlighting](./images/docs/nix-syntax-highlight.png) support. Also Nix code blocks inside `markdown` files also [highlighted](./images/docs/md-embed-nix.png).
- The basic language integration is supported out of the box using `nixfmt` and `nix-instantiate`. Syntax Errors are [linted](./images/docs/linting.png) using `nix-instantiate` while Auto-Formatting is handled by `nixfmt` by default. Custom formatter can be set by [setting `nix.formatterPath`](#custom-formatter).
- The full language support is enabled by [configuring an LSP server](#lsp-plugin-support).
- Snippets are provided for conditional expressions, `let` expressions, `with` expressions, and `rec`ursive sets.
- Path completion support using [PathIntellisense](https://github.com/ChristianKohler/PathIntellisense) extension## 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.
```json5
{
"nix.formatterPath": "nixfmt" // or "nixpkgs-fmt" or "alejandra" or "nix3-fmt" or pass full list of args such as or `["treefmt", "--stdin", "{file}"]`
}
```### LSP Plugin Support
Full language support can be enabled by using a language server. Generally, any Nix [LSP](https://microsoft.github.io/language-server-protocol/) implementation should work.
```json5
{
"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`](https://github.com/oxalica/nil) and [`nixd`](https://github.com/nix-community/nixd).* [`nil` Advanced Settings](./docs/snippets/advanced-nil-settings.jsonc)
* See the [settings documentation](https://github.com/oxalica/nil/blob/main/docs/configuration.md)
* [`nixd` Advanced Settings](./docs/snippets/advanced-nixd-settings.jsonc)
* See the [settings documentation](https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md)## Contributing 💪
We welcome contributions to this extension. Kindly start with any of open issues or feature requests.
See [CONTRIBUTING.md](./CONTRIBUTING.md) for more information.
## Credits
Special thanks to:
- [@wmertens](https://github.com/wmertens) for [writing the grammar](https://github.com/wmertens/sublime-nix/blob/master/nix.tmLanguage).
- The [vscode-fish](https://github.com/bmalehorn/vscode-fish/) extension, which was modified to work for Nix in this extension.