Releases: oxalica/nil
Snapshot release 2025-06-13
Features
-
nixfmt(nixfmt-rfc-style) is now used by default if no formatter is set, as it's becoming the official formatter for nixpkgs.See: NixOS/rfcs#166
-
Support contextual keyword
__curPos. -
Support experimental
|>and|<operators since Nix 2.24 (#155).See: https://github.com/NixOS/nix/blob/2.24.0/doc/manual/src/language/operators.md#pipe-operators
-
--deny-warningsflags fornil diagnostics(#157). -
Multiple files support for
nil diagnostics(#126). -
New assist
remove_unused_binding(#159).{ foo, bar }: { foo = 1; }=>{ foo }: { foo = 1; }let foo = 1; in { }=>let in { }
-
Assist
pack_bindingsnow supports converting implicit attrset into explicit nested one.{ foo.bar = 1; }=>{ foo = { bar = 1; }; }
Fixes
-
Reword and simplify labels of assists, so it's easier to get what is does.
-
Compatibility with latest Nix and Nixpkgs.
-
Compatibility with flakes containing relative subflakes.
Internal
-
The main
flake.nixis simplified to only hasnixpkgsdependency.devShellsare moved to./dev/flake.nixsubflake. -
Bump MSRV to 1.77
-
Bump various dependencies.
-
Documentation tweaks.
Snapshot release 2024-08-06
Sorry for the long hiatus. Life is hard and many things happened this year.
This release contains mostly bugfixes.
Fixes
-
Improve completion from nowhere (24x7 or Ctrl-Space triggered completion).
-
Fix option completion of
types.attrsOf (types.submodule {})(#102). -
Ignore
_prefixed identifier from liveness check. -
Fail textDocument/formatting when no formatter is set (#108).
-
Add
meta.mainProgramfor package (#110). -
Fix panic on merged recursive and non-recursive attrsets (#114).
-
Fix diagnostics exit code help text (#136).
-
Change
nixos.wikilinks to the new official websitewiki.nixos.org(#137, #144). -
Fix build with Nix 2.24
-
Only strip query parameters and fragment for flake ref URLs (#141).
Snapshot release 2023-08-09
Features
-
Load LSP configuration from
initializationOptions(#84), for clients
withoutworkspace/configurationsupport. -
Use semantic token type
booleanfortrueandfalse. (#52) This makes it
possible to distinguish them fromnullwhich has the token typeconstant. -
nil diagnosticsexists with code 1 only if there is any error. (#90)
Warnings are not counted for exit code now. -
Impl memory limit configuration for flake evaluation, with config key
nil.nix.maxMemoryMB. Only Linux platforms are supported yet. -
Highly experimental SSR (Structural Search & Replace) impl as CLI
nil ssr.
Fixes
-
Send
workspace/configurationonly if the client supports it (#85) -
Only show references of
withwhen the cursor is exactly onwith. -
Also show references of a variable when cursor's on one of them (#86).
-
Fix flake reloading condition on file changes (#92).
-
Fix popup message to mention
autoArchiveconfig (#96). -
Fix build with nix 2.17 (#94).
-
Fix missed diagnostic update on the first open (#89).
-
Fix nondeterminism of diagnostics ordering.
-
Fix parsing of block comments.
-
Fix offset conversion for end of file (#100).
-
Fix many more typos.
Internal
-
Response time and size logging via
NIL_LOG=nil=debug. Useful for debugging.
Log messages >=DEBUG are now included in the release build, though disabled
unless having filter envvarNIL_LOGset. -
Delay link resolution in
textDocument/documentLink.
This reduces the time oftextDocument/documentLinkfrom ~100ms down
to ~20ms for MB-sized files. Editors doing frequent query of links like
coc.nvim can benefit a lot from it. -
Filter out far away spans in
textDocument/documentHighlightas
optimization. They are not displayed anyway. -
Enable LTO for release builds.
-
Bump MSRV to 1.70
-
Drop support for file-backed stdin/stdout in language server mode.
It makes no sense.
Snapshot release 2023-05-09
This is a patch release for previously missing configurables of the new
auto-evaluation features.
Fixes
-
Add configurations to enable/disable and customize auto-evaluations.
nil.nix.flake.{autoArchive,autoEvalInputs,nixpkgsInputName}
See./docs/configuration.mdfor more details. -
autoEvalInputsis disabled by default due to issues (#79) about
flake locks. -
Nixpkgs detection for NixOS options now checks existences of
liband
module-list.nixto reduce mis-detections. (#80)
Snapshot release 2023-05-02
Happy International Workers' Day! Fight for workers' rights against
overwork "culture" in China!
Features
-
Automatic flake archiving.
-
Flake inputs evaluation and type inference. (#76)
Due to limitations of
nix flake showbackend, only known output fields are
completed, includingpackagesordevShells, but not customlib.
legacyPackagesis only traversed since Nix 2.14, the first version to
support filtering packages for only the current system.# flake.nix { inputs.rust-overlay.url = "github:oxalica/rust-overlay"; outputs = { rust-overlay, ... }: let rustPkg = rust-overlay.packages.x86_64-linux.|; # default, rust, rust_nightly, ... in ...; }
-
Dynamic fields are now inferred to the rest type.
This helps the common flake output usage:
rust-overlay.packages.${system}.| # default, rust, ... -
Auto-reloading flake when
flake.{nix,lock}is changed on disk.This requires the LSP client to support
didChangeWatchedFilescapability.
VSCode and coc.nvim support it out-of-box, while Neovim's builtin LSP
requires manual configurations
(neovim/neovim#22405 (comment)). -
Progress bars for various costly loading operations.
Fixes
- Suppress unused warnings for flake auto-inputs. (#73)
- Parsing errors for string escapes. (#75)
- Completion for fresh-created unsaved
flake.nix.
Internal
- The LSP frontend is heavily refactored into async-style. The framework
library is also switched from lsp-server to async-lsp. (#74) - MSRV is bumped to 1.68
Snapshot release 2023-04-03
Features
-
Code actions about string rewriting. (#69)
quote_attrandunquote_attrto quote/unquote attributes in
attrset or let-in.rewrite_string_to_indentedandrewrite_indented_to_stringto
rewrite between two string styles.rewrite_uri_to_stringto rewrite deprecated URI literals into
strings.
-
Completion for NixOS options.
This requires a working Flake setup, which has an input named
nixpkgsfor the source of NixOS options. It must be a relatively
recent version ofgithub:NixOS/nixpkgs. If you have multiple nixpkgs
in your inputs, you can create an aliasinputs.nixpkgs.follows = "the-input-to-use"to select one.If it's correctly recognized and evaluated, any NixOS-module-like Nix
files will get completions and type information for NixOS options.For example:
{ ... }: { nix.settings.| # -> allowed-users, auto-optimise-store, ... }
-
The LSP server now reports server name
niland its version (if any)
to the client throughserverInfoduring initialization.
Fixes
- Parsing errors when
'appears in indented strings. - Panics when a flake input is named
self. - Unescaped identifiers and/or attributes in completions.
- Recognition of
flake.nixwhenrec { ... }is used in top-level.
Snapshot release 2023-03-11
Snapshot release 2023-03-01
Features
-
Better completions, documentations and types for
builtins.
Nowbuiltins.|completes correctly with signatures and
documentations. -
Virtual path support. This is used by VSCode or coc.nvim when editing
a new untitled file with filetype set to nix. -
A coc.nvim extension
coc-nilundereditors/coc-nilfor simpler
startup. Currently it is still working in progress and does nothing
more than passing coc.nvim configurations to the LSP.The extension is exported as flake output package
coc-nil, or
vimPlugins.coc-nilwhen using overlays.
Fixes
followsresolution of flake locks.- Panics when
flake_graphis accessed but not set. - Documentation typos.
Snapshot release 2023-02-03
Happy EastAsianLunisolarCalendar new year!
Breaking
- Bump minimal supported rust version to 1.66
Features
-
Type schema for flake.nix.
Common fields of flake definitions as well as defined inputs are subjects to
completion now. -
Goto-definition for flake inputs. The
nameininputs.name = ...and
outputs = { name, ... }: ...will take you to theflake.nixof the input
inside Nix store.This requires an working
nixbinary and a validflake.lock. -
Completion for pat-parameters definitions.
This also works in parameters of flake outputs.
{ inputs.nixpkgs.url = "..."; outputs = { n| }: { }; } -
Add CLI for diagnostics. Now you can also run
nilas a linter. -
Support
convert_to_inheritforlet inandrec { }. -
Documentation of all code actions now lives in
docs/code_actions.md.
Fixes
- LSP mishandling in DidChangeTextDocument, which caused issues on kakoune.
- Missed error and panic information in log. Now a backtrace is captured
if possible when the worker panicked.
Snapshot release 2023-01-01
Happy GregorianCalendar new year!
Features
-
Add many code actions for refactoring or fix.
Thanks to figsoda@github for implementations.-
"Convert to
inherit" now supports multiple LHS or RHS.
{ a.b = b; }=>{ a = { inherit b; }; }
{ a = b.a; }=>{ inherit (b) a; } -
Add unresolved names to top-level lambda parameters.
{ foo }: foo + bar=>{ foo, bar }: foo + bar -
Remove empty
inherits.
{ inherit; }=>{ }
-
-
Names from
withnow have a special semantic token modifier
withAttribute. One can add styles like underlines to them to distinguish
them from other static bindings.
There are examplesdev/nix-ide-semantic-highlighting.patchfor VSCode and
dev/vim-coc.nixfor (Neo)Vim/coc.nvim.
Fixes
- Names of semantic highlighting are tweaked. Now we use
constantand
builtinfor builtin constants (true) and functions (map).
The standarddefaultLibrarygroup in themes usually represent names
from the "standard library", like rust-analyzer did, which is not the
same as "builtin" constants.