ITADN

版本发布 8

2.9.0
? · 2026-02-07

# nixd v2.9.0: Intelligent Refactoring Welcome to nixd 2.9.0! This release features an extensive suite of Code Actions contributed by [@takeokunn](https://github.com/takeokunn), greatly enhancing flexibility when working with Nix expressions. We have also optimized documentation support and performance details. ## 🌟 Highlights ### 🛠️ Powerful Code Refactoring (Code Actions) Nix can sometimes feel verbose. This update introduces a series of "one-click refactors" to keep your code clean: #### AttrSet Restructuring * **Flatten & Pack**: Quickly convert between nested sets and dotted paths ([#757](https://github.com/nix-community/nixd/pull/757), [#758](https://github.com/nix-community/nixd/pull/758)). ```nix { foo = { bar = 1; }; } # <-> { foo.bar = 1; } ``` * **The "Pack" Series**: Added Pack One, Shallow Pack All, and Recursive Pack All to easily reorganize complex attribute definitions ([#759](https://github.com/nix-community/nixd/pull/759)). * **Pack One**: Transforms a single dotted binding into a nested set. * `{ foo.bar = 1; }` → `{ foo = { bar = 1; }; }` * **Shallow Pack All**: When siblings share a prefix, packs the first level but preserves remaining dots. * `{ foo.bar.x = 1; foo.baz = 2; }` → `{ foo = { bar.x = 1; baz = 2; }; }` * **Recursive Pack All**: Fully nests all sibling bindings recursively. * `{ foo.bar.x = 1; foo.baz = 2; }` → `{ foo = { bar = { x = 1; }; baz = 2; }; }` #### Syntax Transformations * **Inherit Conversion**: Convert explicit bindings to `inherit` syntax, or expand them back ([#770](https://github.com/nix-community/nixd/pull/770), [#773](https://github.com/nix-community/nixd/pull/773)). ```nix # Pattern: Simple variable assignment { foo = foo; bar = bar; } -> { inherit foo bar; } # Pattern: Select from source { x = lib.x; y = lib.y; } -> { inherit (lib) x y; } ``` * **Eliminate `with`**: Provides actions to refactor `with` statements into safer `let/inherit` bindings ([#768](https://github.com/nix-community/nixd/pull/768)). ```nix # Before with lib; optionalString true "yes" # After let inherit (lib) optionalString; in optionalString true "yes" ``` * **Strings & Quotes**: Support for adding/removing quotes from attribute names ([#756](https://github.com/nix-community/nixd/pull/756)) and string literal syntax conversion ([#775](https://github.com/nix-community/nixd/pull/775)). #### Developer Productivity * **JSON to Nix**: Convert selected JSON snippets to Nix format instantly ([#763](https://github.com/nix-community/nixd/pull/763)). * **Extract to File**: Extract a selected expression and refactor it into a standalone file ([#767](https://github.com/nix-community/nixd/pull/767)). * **Auto-complete Formals**: For undefined variables, use a Code Action to add them to function formals ([#777](https://github.com/nix-community/nixd/pull/777)). * **Quick Cleanup**: Automatically remove unused `let` bindings ([#779](https://github.com/nix-community/nixd/pull/779)). ### 📚 Documentation & Interaction * **Noogle Integration**: Unsure how to use a `lib` function? You can now open [noogle.dev](https://noogle.dev) documentation directly via a Code Action ([#764](https://github.com/nix-community/nixd/pull/764)). * **Enhanced Hover**: Hovering now supports expression selection and provides more detailed documentation ([#745](https://github.com/nix-community/nixd/pull/745)). These descriptions are pulled directly from Doc-comments within nixpkgs. <img width="551" height="284" alt="image" src="https://github.com/user-attachments/assets/595e9dc9-9c3d-4570-ac2b-a24980d0245f" /> <img width="488" height="177" alt="image" src="https://github.com/user-attachments/assets/62d041f8-c946-4fa0-a098-58055341458e" /> ## 🐞 Fixes & Improvements * **Formatting Optimization**: Saving is only triggered if the formatter actually modifies the code, reducing unnecessary pop-ups ([#771](https://github.com/nix-community/nixd/pull/771)) - by @cubewhy. * **Semantic Fixes**: Fixed incorrect diagnostics when using `inherit (builtins)` inside `let` blocks ([#782](https://github.com/nix-community/nixd/pull/782)). nixd now correctly handles these in `let` blocks while ignoring them in standard attrsets. * **Stability**: Added regression tests for Hover functionality ([#781](https://github.com/nix-community/nixd/pull/781)). ## 🤝 Community * A special welcome to our new contributor **[@cubewhy](https://github.com/cubewhy)**! * Congratulations to **[@takeokunn](https://github.com/takeokunn)** for becoming the Code Owner for the Code Actions module in `nixd`. --- **Full Changelog**: [v2.8.2...v2.9.0](https://github.com/nix-community/nixd/compare/2.8.2...2.9.0)

2.8.1
? · 2025-12-26

<!-- Release notes generated using configuration in .github/release.yml at 2.8.1 --> ## What's Changed ### Bug Fixes * libnixf/Sema/VariableLookup: fix inherit non-var by @inclyc in https://github.com/nix-community/nixd/pull/743, reported by @johngalt ### Other Changes * build(deps): bump actions/upload-artifact from 5 to 6 by @dependabot[bot] in https://github.com/nix-community/nixd/pull/736 * build(deps): bump tj-actions/changed-files from 46 to 47 by @dependabot[bot] in https://github.com/nix-community/nixd/pull/715 **Full Changelog**: https://github.com/nix-community/nixd/compare/2.8.0...2.8.1

2.8.0
? · 2025-12-24

<!-- Release notes generated using configuration in .github/release.yml at 2.8.0 --> ## What's Changed <div align="center"> <h3>This version primarily focuses on enhancing primop (builtin) support in nixd. </h3> Context: https://github.com/NixOS/nixpkgs/pull/449123 </div> ### New Features **Validate `builtins` members:** (by @inclyc) nixd now checks if a member accessed via `builtins` actually exists. If an unknown primop is detected, a diagnostic error is triggered. ```nix builtins.concatStringSep # ^ Error: Unknown primop ``` **Suggest removing redundant `builtins.` prefixes:** (by @inclyc) For globally available primops (like `map`), nixd will suggest removing the `builtins.` prefix to keep the code concise. ```nix builtins.map # ^^^^^ Hint: 'map' is globally available; 'builtins.' is unnecessary. ``` **Suggest to add `builtins` prefixes:** (by @inclyc) <img width="343" height="175" alt="image" src="https://github.com/user-attachments/assets/538d8c5d-cd3f-4357-956a-186959ee9267" /> **Give warnings when user code overrides built-in names** (by @inclyc) Special thanks to @Mic92 for the suggestion! In the Nix language, it is possible to override (shadow) builtin names. However, this is generally considered a bad practice as it is highly error-prone. For example: ``` nix-repl> let __lessThan = a: b: true; in 2 < 1 true ``` Now nixd will place a warning on `__lessThan` definition: ``` overriding a builtin name `__lessThan` is discouraged, rename it to avoid confusion ``` ### Bug Fixes * libnixf/Sema: make constants available in `builtins` attrset by @inclyc in https://github.com/nix-community/nixd/pull/723 * libnixf/package: fix `meta.mainProgram` by @jfly in https://github.com/nix-community/nixd/pull/730 * libnixf/Sema: fixes #731 by creating a trivial env for empty let-in exprs by @inclyc in https://github.com/nix-community/nixd/pull/734 * libnixf/Sema: allow `inherit (builtins) var` by @inclyc in https://github.com/nix-community/nixd/pull/741 ### Documentation * docs: remove $ from editors.md by @melonSorbet in https://github.com/nix-community/nixd/pull/737 ### Other Changes * nixd/Controller: clear diagnostics when removing document by @rszyma in https://github.com/nix-community/nixd/pull/716 * build(deps): bump actions/upload-artifact from 4 to 5 by @dependabot[bot] in https://github.com/nix-community/nixd/pull/725 * build(deps): bump actions/checkout from 5 to 6 by @dependabot[bot] in https://github.com/nix-community/nixd/pull/729 ## New Contributors * @rszyma made their first contribution in https://github.com/nix-community/nixd/pull/716 * @jfly made their first contribution in https://github.com/nix-community/nixd/pull/730 * @melonSorbet made their first contribution in https://github.com/nix-community/nixd/pull/737 ## 🎉 Event Announcement I’ll be giving a talk on nixd at the [NixOS CN Meetup #2](https://meetup.nixos-cn.org/meetup-2-guide/), [slides](https://inclyc.github.io/talk-nixf-nixd/). This session is tailored for the Chinese NixOS community, and I’m looking forward to sharing some insights with you all. 欢迎一起交流 ❤️ . **Full Changelog**: https://github.com/nix-community/nixd/compare/2.7.0...2.8.0

2.6.4
? · 2025-05-09

<!-- Release notes generated using configuration in .github/release.yml at 2.6.4 --> ## What's Changed ### New Features * libnixf/Parse: preserve `=` for bindings by @inclyc in https://github.com/nix-community/nixd/pull/684 * nixd: enable completion and hover in config sets by @not-my-profile in https://github.com/nix-community/nixd/pull/678 In NixOS modules options can be defined at the top-level, e.g: { foo = true; } or inside of `config`, e.g: { config = { foo = true; }; } Autocompletion and hover information before only worked for the former because the option resolving code had no special handling for `config`. Fixes #566. * Update to Nix 2.28 by @Ericson2314 in https://github.com/nix-community/nixd/pull/669 ### Other Changes * nixd/Controller: precommit test for #629 by @inclyc in https://github.com/nix-community/nixd/pull/685 * nixd/test: specify textDocument/didOpen via nix code blocks by @not-my-profile in https://github.com/nix-community/nixd/pull/679 * lspserver: rename `JSONStreamStyle::Delimited` → `LitTest` by @inclyc in https://github.com/nix-community/nixd/pull/682 * nixd/tools/nixd-attrset-eval: provide `getDoc` information from C++ nix by @inclyc in https://github.com/nix-community/nixd/pull/677 ## New Contributors * @Ericson2314 made their first contribution in https://github.com/nix-community/nixd/pull/669 * @not-my-profile made their first contribution in https://github.com/nix-community/nixd/pull/678 **Full Changelog**: https://github.com/nix-community/nixd/compare/2.6.3...2.6.4

2.6.2
? · 2025-03-21

<!-- Release notes generated using configuration in .github/release.yml at 2.6.2 --> ## What's Changed ### New Features * libnixf: diagose "or" keyword used as a binary operator by @inclyc in https://github.com/nix-community/nixd/pull/650 ### Bug Fixes * nixf: declare Tokens.h dependency for libnixf by @trofi in https://github.com/nix-community/nixd/pull/662 ### Other Changes * build(deps): bump cachix/cachix-action from 15 to 16 by @dependabot in https://github.com/nix-community/nixd/pull/660 * build(deps): bump tj-actions/changed-files from 45 to 46 by @dependabot in https://github.com/nix-community/nixd/pull/659 * build(deps): bump cachix/install-nix-action from 30 to 31 by @dependabot in https://github.com/nix-community/nixd/pull/658 ## New Contributors * @trofi made their first contribution in https://github.com/nix-community/nixd/pull/662 **Full Changelog**: https://github.com/nix-community/nixd/compare/2.6.1...2.6.2

2.6.1
? · 2025-02-02

<!-- Release notes generated using configuration in .github/release.yml at 2.6.1 --> ## What's Changed ### Bug Fixes * fix(completion): correctly parse incomplete attrsets and provide completions by @Aetherall in https://github.com/nix-community/nixd/pull/644 * libnixf: generate token spelling from python script by @inclyc in https://github.com/nix-community/nixd/pull/648 ### Documentation * docs: fix typo `opitons` → `options` by @mhanberg in https://github.com/nix-community/nixd/pull/646 ## New Contributors * @Aetherall made their first contribution in https://github.com/nix-community/nixd/pull/644 * @mhanberg made their first contribution in https://github.com/nix-community/nixd/pull/646 **Full Changelog**: https://github.com/nix-community/nixd/compare/2.6.0...2.6.1

2.6.0
? · 2025-01-09

<!-- Release notes generated using configuration in .github/release.yml at 2.6.0 --> <div align="center"> <p> <strong>Needs to bump llvmPackages → 19</strong> </p> </div> ---- ## What's Changed ### Bug Fixes * nixd/lspserver: fix high cpu on fd polling by @jduepmeier in https://github.com/nix-community/nixd/pull/628 * libnixf/Parse: handle indented strings `''\` escape sequence by @inclyc in https://github.com/nix-community/nixd/pull/642 ### Other Changes * ci: don't run on "pull_request" by @inclyc in https://github.com/nix-community/nixd/pull/618 * ci: re-add pull_request by @Mic92 in https://github.com/nix-community/nixd/pull/621 * nixd/lib/Controller: use `CheckReturn` to simplify early-returns (NFC) by @inclyc in https://github.com/nix-community/nixd/pull/623 * fix compilation with nix 2.25 by @Mic92 in https://github.com/nix-community/nixd/pull/624 * .github/workflows: bump "cachix/install-nix-action" to v30 by @inclyc in https://github.com/nix-community/nixd/pull/631 * .github/dependabot: init, update action versions by @inclyc in https://github.com/nix-community/nixd/pull/632 * build(deps): bump actions/checkout from 3 to 4 by @dependabot in https://github.com/nix-community/nixd/pull/633 * build(deps): bump actions/upload-artifact from 3 to 4 by @dependabot in https://github.com/nix-community/nixd/pull/635 * flake: update the lock by @inclyc in https://github.com/nix-community/nixd/pull/630 * build(deps): bump cachix/cachix-action from 12 to 15 by @dependabot in https://github.com/nix-community/nixd/pull/637 * build(deps): bump tj-actions/changed-files from 44 to 45 by @dependabot in https://github.com/nix-community/nixd/pull/636 * build(deps): bump peaceiris/actions-gh-pages from 3 to 4 by @dependabot in https://github.com/nix-community/nixd/pull/634 * {flake, nixd/lspserver}: bump llvm 16 → 19 by @inclyc in https://github.com/nix-community/nixd/pull/639 ## New Contributors * @jduepmeier made their first contribution in https://github.com/nix-community/nixd/pull/628 * @dependabot made their first contribution in https://github.com/nix-community/nixd/pull/633 **Full Changelog**: https://github.com/nix-community/nixd/compare/2.5.1...2.6.0

2.5.1
? · 2024-11-16

<!-- Release notes generated using configuration in .github/release.yml at 2.5.1 --> ## What's Changed ### Bug Fixes * nixd/lib/Controller: disable semantic tokens feature during init by @inclyc in https://github.com/nix-community/nixd/pull/616 * libnixf/Sema: mark nested with expressions alive by @inclyc in https://github.com/nix-community/nixd/pull/617 **Full Changelog**: https://github.com/nix-community/nixd/compare/2.5.0...2.5.1