Nix language support in Zed
Various options can be configured via Zed settings.json
files.
{
"lsp": {
"nixd": {
"settings": {
"diagnostic": {
"suppress": [ "sema-extra-with" ]
}
}
}
}
}
See: Nixd LSP Configuration Docs for more options.
{
"lsp": {
"nil": {
"settings": {
"diagnostics": {
"ignored": [ "unused_binding" ]
}
}
}
}
}
See: Nil LSP Configuration Docs for more options.
{
"languages": {
"Nix": {
"language_servers": [ "nixd", "!nil" ]
}
}
}
{
"languages": {
"Nix": {
"language_servers": [ "nil", "!nixd" ]
}
}
}
You can configure formatters through LSP:
{
"lsp": {
"nil": { // or "nixd":
"initialization_options": {
"formatting": {
"command": ["alejandra", "--quiet", "--"] // or ["nixfmt"]
}
}
}
}
}
Or through Zed itself:
{
"languages": {
"Nix": {
"formatter": {
"external": {
"command": "alejandra", // or "nixfmt"
"arguments": ["--quiet", "--"]
}
}
}
}
}