Releases: oxalica/nil
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.mainProgram
for package (#110). -
Fix panic on merged recursive and non-recursive attrsets (#114).
-
Fix diagnostics exit code help text (#136).
-
Change
nixos.wiki
links 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/configuration
support. -
Use semantic token type
boolean
fortrue
andfalse
. (#52) This makes it
possible to distinguish them fromnull
which has the token typeconstant
. -
nil diagnostics
exists 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/configuration
only if the client supports it (#85) -
Only show references of
with
when 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
autoArchive
config (#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_LOG
set. -
Delay link resolution in
textDocument/documentLink
.
This reduces the time oftextDocument/documentLink
from ~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/documentHighlight
as
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.md
for more details. -
autoEvalInputs
is disabled by default due to issues (#79) about
flake locks. -
Nixpkgs detection for NixOS options now checks existences of
lib
and
module-list.nix
to 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 show
backend, only known output fields are
completed, includingpackages
ordevShells
, but not customlib
.
legacyPackages
is 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
didChangeWatchedFiles
capability.
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_attr
andunquote_attr
to quote/unquote attributes in
attrset or let-in.rewrite_string_to_indented
andrewrite_indented_to_string
to
rewrite between two string styles.rewrite_uri_to_string
to rewrite deprecated URI literals into
strings.
-
Completion for NixOS options.
This requires a working Flake setup, which has an input named
nixpkgs
for 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
nil
and its version (if any)
to the client throughserverInfo
during 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.nix
whenrec { ... }
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-nil
undereditors/coc-nil
for 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-nil
when using overlays.
Fixes
follows
resolution of flake locks.- Panics when
flake_graph
is 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
name
ininputs.name = ...
and
outputs = { name, ... }: ...
will take you to theflake.nix
of the input
inside Nix store.This requires an working
nix
binary 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
nil
as a linter. -
Support
convert_to_inherit
forlet in
andrec { }
. -
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
inherit
s.
{ inherit; }
=>{ }
-
-
Names from
with
now 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.patch
for VSCode and
dev/vim-coc.nix
for (Neo)Vim/coc.nvim
.
Fixes
- Names of semantic highlighting are tweaked. Now we use
constant
and
builtin
for builtin constants (true
) and functions (map
).
The standarddefaultLibrary
group in themes usually represent names
from the "standard library", like rust-analyzer did, which is not the
same as "builtin" constants.
2022-12-01
Snapshot release 2022-12-01
Features
-
Code actions.
foo = foo;
=>inherit foo;
foo.bar = 1; foo.bux = 2;
=>foo = { bar = 1; bux = 2; };
foo = { bar = 1; bux = 2; };
=>foo.bar = 1; foo.bux = 2;
Currently comments and whitespaces (including indentations) are preserved.
-
Highlight related texts.
Highlight texts related to the one under the cursor.
Don't be confused with semantic highlighting.- Highlight definitions and references when cursor's on identifiers.
- Highlight all (attribute) references when cursor's on
with
. - Highlight all effective
with
s when cursor's on attributes fromwith
.
-
Add configuration
nil.diagnostics.excludedFiles
to disable diagnostics for
some file paths, like generated ones. -
Configurations are now fully documented in
docs/configuration.md
.
Fixes
-
Don't emit debuginfo for the default release profile. This is somehow
introduced accidentally. Nix builds are not affected due tostrip
. -
Semantic highlighting is optimized and should work fluently with big files.
-
Semantic highlighting now ignores string literal inners, to integrate better
with language injections (eg.nvim-treesitter
). They would still be
rendered as default string color if there is no injection.
Internal changes
-
More syntax desugaring code are moved into
syntax
crate and are made more
portable. -
More tests and optimizations for
syntax
.