NIx Language server, an incremental analysis assistant for writing in Nix.
Load LSP configuration from initializationOptions
(#84), for clients
without workspace/configuration
support.
Use semantic token type boolean
for true
and false
. (#52) This makes it
possible to distinguish them from null
which has the token type constant
.
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
.
Send workspace/configuration
only if the client supports it (#85)
Only show references of with
when the cursor is exactly on with
.
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.
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 envvar NIL_LOG
set.
Delay link resolution in textDocument/documentLink
.
This reduces the time of textDocument/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.
This is a patch release for previously missing configurables of the new auto-evaluation features.
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)
Happy International Workers' Day! Fight for workers' rights against overwork "culture" in China!
Automatic flake archiving.
Flake inputs evaluation and type inference. (#76)
Due to limitations of nix flake show
backend, only known output fields are
completed, including packages
or devShells
, but not custom lib
.
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
(https://github.com/neovim/neovim/pull/22405#issuecomment-1453269735).
Progress bars for various costly loading operations.
flake.nix
.Code actions about string rewriting. (#69)
quote_attr
and unquote_attr
to quote/unquote attributes in
attrset or let-in.rewrite_string_to_indented
and rewrite_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 of github:NixOS/nixpkgs
. If you have multiple nixpkgs
in your inputs, you can create an alias inputs.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 through serverInfo
during initialization.
'
appears in indented strings.self
.flake.nix
when rec { ... }
is used in top-level.remove_empty_let_in
. (#63)
let in foo
=> foo
Better completions, documentations and types for builtins
.
Now builtins.|
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
under editors/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.
follows
resolution of flake locks.flake_graph
is accessed but not set.Happy EastAsianLunisolarCalendar
new year!
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
in inputs.name = ...
and
outputs = { name, ... }: ...
will take you to the flake.nix
of the input
inside Nix store.
This requires an working nix
binary and a valid flake.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
for let in
and rec { }
.
Documentation of all code actions now lives in docs/code_actions.md
.
Happy GregorianCalendar new year!
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 examples dev/nix-ide-semantic-highlighting.patch
for VSCode and
dev/vim-coc.nix
for (Neo)Vim/coc.nvim
.
constant
and
builtin
for builtin constants (true
) and functions (map
).
The standard defaultLibrary
group in themes usually represent names
from the "standard library", like rust-analyzer did, which is not the
same as "builtin" constants.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.
with
.with
s when cursor's on attributes from with
.Add configuration nil.diagnostics.excludedFiles
to disable diagnostics for
some file paths, like generated ones.
Configurations are now fully documented in docs/configuration.md
.
Don't emit debuginfo for the default release profile. This is somehow
introduced accidentally. Nix builds are not affected due to strip
.
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.
More syntax desugaring code are moved into syntax
crate and are made more
portable.
More tests and optimizations for syntax
.
Mostly for bug fixes, some of which are annoying. The snapshot period will be slowing down if there are no interesting changes or big bug fixes.
New features:
Document links. textDocument/documentLink
Valid relative paths, URLs and flake references now report as links. For VSCode, it's shown as underlined text, and a hand-shaped cursor is shown when moving over them. Ctrl-Click would open the target file or URL.
Store Attr source information in types.
It is not quite useful for now, and is only be used by the "completion kind" during completion. We'll find a way to support goto-definition for it in the future.
Fixes:
if
conditions.