2022-11-25 23:41:09 +08:00
|
|
|
## LSP Configuration
|
|
|
|
|
2023-03-08 12:20:59 +08:00
|
|
|
There are some tunable options and settings for nil.
|
2022-12-25 02:39:04 +05:30
|
|
|
They are retrieved via LSP and support runtime modification.
|
2022-11-25 23:41:09 +08:00
|
|
|
|
|
|
|
All settings are nested under a key `"nil"`.
|
|
|
|
For example, `formatting.command` means to write
|
|
|
|
`"nil": { "formatting": { "command": ["your-command"] } }`
|
|
|
|
in JSON, not `"nil.formatting.command": ["wrong"]`.
|
|
|
|
|
2023-03-08 12:20:59 +08:00
|
|
|
The place to write LSP configurations differs between clients (i.e. editors and editor plugins).
|
|
|
|
Please refer to their corresponding documentation.
|
2022-11-25 23:41:09 +08:00
|
|
|
There are some examples for common editor/plugins in [README](../README.md).
|
|
|
|
|
|
|
|
### Reference
|
|
|
|
|
2023-03-08 12:20:59 +08:00
|
|
|
Default configuration:
|
2022-11-25 23:41:09 +08:00
|
|
|
|
|
|
|
```jsonc
|
|
|
|
{
|
|
|
|
"nil": {
|
|
|
|
"formatting": {
|
|
|
|
// External formatter command (with arguments).
|
|
|
|
// It should accepts file content in stdin and print the formatted code into stdout.
|
|
|
|
// Type: [string] | null
|
2024-09-18 23:06:38 -04:00
|
|
|
// Example: ["nixfmt"]
|
2022-12-25 02:39:04 +05:30
|
|
|
"command": null,
|
2022-11-25 23:41:09 +08:00
|
|
|
},
|
|
|
|
"diagnostics": {
|
|
|
|
// Ignored diagnostic kinds.
|
|
|
|
// The kind identifier is a snake_cased_string usually shown together
|
|
|
|
// with the diagnostic message.
|
|
|
|
// Type: [string]
|
|
|
|
// Example: ["unused_binding", "unused_with"]
|
|
|
|
"ignored": [],
|
|
|
|
// Files to exclude from showing diagnostics. Useful for generated files.
|
|
|
|
// It accepts an array of paths. Relative paths are joint to the workspace root.
|
|
|
|
// Glob patterns are currently not supported.
|
|
|
|
// Type: [string]
|
|
|
|
// Example: ["Cargo.nix"]
|
|
|
|
"excludedFiles": [],
|
|
|
|
},
|
2023-01-28 04:32:41 +08:00
|
|
|
"nix": {
|
|
|
|
// The path to the `nix` binary.
|
|
|
|
// Type: string
|
|
|
|
// Example: "/run/current-system/sw/bin/nix"
|
|
|
|
"binary": "nix",
|
2023-07-09 05:14:08 +08:00
|
|
|
// The heap memory limit in MiB for `nix` evaluation.
|
2023-07-09 02:18:25 +08:00
|
|
|
// Currently it only applies to flake evaluation when `autoEvalInputs` is
|
2023-07-09 05:14:08 +08:00
|
|
|
// enabled, and only works for Linux. Other `nix` invocations may be also
|
2023-07-09 02:18:25 +08:00
|
|
|
// applied in the future. `null` means no limit.
|
2023-07-09 05:14:08 +08:00
|
|
|
// As a reference, `nix flake show --legacy nixpkgs` usually requires
|
|
|
|
// about 2GiB memory.
|
2023-07-09 02:18:25 +08:00
|
|
|
//
|
|
|
|
// Type: number | null
|
|
|
|
// Example: 1024
|
2023-07-09 05:14:08 +08:00
|
|
|
"maxMemoryMB": 2560,
|
2023-05-07 02:18:18 +08:00
|
|
|
"flake": {
|
|
|
|
// Auto-archiving behavior which may use network.
|
|
|
|
//
|
|
|
|
// - null: Ask every time.
|
2023-08-06 22:20:45 +08:00
|
|
|
// - true: Automatically run `nix flake archive` when necessary.
|
2023-05-07 02:18:18 +08:00
|
|
|
// - false: Do not archive. Only load inputs that are already on disk.
|
|
|
|
// Type: null | boolean
|
2023-05-07 02:40:55 +08:00
|
|
|
// Example: true
|
2023-05-07 02:18:18 +08:00
|
|
|
"autoArchive": null,
|
2023-05-07 02:40:55 +08:00
|
|
|
// Whether to auto-eval flake inputs.
|
|
|
|
// The evaluation result is used to improve completion, but may cost
|
|
|
|
// lots of time and/or memory.
|
|
|
|
//
|
|
|
|
// Type: boolean
|
2023-05-09 01:16:20 +08:00
|
|
|
// Example: true
|
|
|
|
"autoEvalInputs": false,
|
2023-05-07 02:40:55 +08:00
|
|
|
// The input name of nixpkgs for NixOS options evaluation.
|
|
|
|
//
|
|
|
|
// The options hierarchy is used to improve completion, but may cost
|
|
|
|
// lots of time and/or memory.
|
|
|
|
// If this value is `null` or is not found in the workspace flake's
|
|
|
|
// inputs, NixOS options are not evaluated.
|
|
|
|
//
|
|
|
|
// Type: null | string
|
|
|
|
// Example: "nixos"
|
|
|
|
"nixpkgsInputName": "nixpkgs",
|
2023-05-07 02:18:18 +08:00
|
|
|
},
|
2023-01-28 04:32:41 +08:00
|
|
|
},
|
2022-11-25 23:41:09 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|