From e32bc41b85886c7742cb9051c065086d51185a68 Mon Sep 17 00:00:00 2001 From: Soliprem <73885403+Soliprem@users.noreply.github.com> Date: Wed, 26 Nov 2025 01:54:48 +0100 Subject: [PATCH 1/3] modules/languages: fix rust crates-nvim completion deprecation (#1247) * modules/languages: fix rust crates-nvim deprecation move the completion into the lsp * plugins/languages: cleanup old FIXME, remove comments, complete completion config for crates-nvim * docs/rl: add entry for crates-nvim fix --- configuration.nix | 2 +- docs/release-notes/rl-0.8.md | 1 + modules/plugins/languages/rust.nix | 63 ++++++++++++++---------------- 3 files changed, 31 insertions(+), 35 deletions(-) diff --git a/configuration.nix b/configuration.nix index 750862af..cc314288 100644 --- a/configuration.nix +++ b/configuration.nix @@ -69,7 +69,7 @@ isMaximal: { typst.enable = isMaximal; rust = { enable = isMaximal; - crates.enable = isMaximal; + extensions.crates-nvim.enable = isMaximal; }; # Language modules that are not as common. diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 07550898..982102ac 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -507,6 +507,7 @@ - fix broken `neorg` grammars - remove obsolete warning in the `otter` module - add mainProgram attribute to vala language server wrapper +- fix `crates-nvim`'s completions by using the in-program lsp [JManch](https://github.com/JManch): diff --git a/modules/plugins/languages/rust.nix b/modules/plugins/languages/rust.nix index 157c3d17..fea75305 100644 --- a/modules/plugins/languages/rust.nix +++ b/modules/plugins/languages/rust.nix @@ -10,7 +10,7 @@ inherit (lib.strings) optionalString; inherit (lib.lists) isList; inherit (lib.attrsets) attrNames; - inherit (lib.types) bool package str listOf either enum; + inherit (lib.types) bool package str listOf either enum int; inherit (lib.nvim.lua) expToLua toLuaObject; inherit (lib.nvim.attrsets) mapListToAttrs; inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf; @@ -94,19 +94,26 @@ in { enable = mkEnableOption "crates.io dependency management [crates-nvim]"; setupOpts = mkPluginSetupOption "crates-nvim" { - completion.cmp.enable = mkOption { - type = bool; - default = config.vim.autocomplete.nvim-cmp.enable; - defaultText = "{option}`config.vim.autocomplete.nvim-cmp.enable`"; - description = '' - Whether to add crates.nvim as a source for completion plugins. The following - plugins are supported by crates.nvim: - - * nvim-cmp - * coq.nvim - - However nvf only supports auto-setup for nvim-cmp. - ''; + lsp = { + enabled = mkEnableOption "crates.nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;}; + actions = mkEnableOption "actions for crates-nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;}; + completion = mkEnableOption "completion for crates-nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;}; + hover = mkEnableOption "hover actions for crates-nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;}; + }; + completion = { + crates = { + enabled = mkEnableOption "completion for crates-nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;}; + max_results = mkOption { + description = "The maximum number of search results to display"; + type = int; + default = 8; + }; + min_chars = mkOption { + description = "The minimum number of characters to type before completions begin appearing"; + type = int; + default = 3; + }; + }; }; }; }; @@ -197,26 +204,14 @@ in { }) (mkIf cfg.extensions.crates-nvim.enable { - vim = let - withCompletion = cfg.extensions.crates-nvim.setupOpts.completion.cmp.enable; - in - mkMerge [ - { - startPlugins = ["crates-nvim"]; - pluginRC.rust-crates = entryAnywhere '' - require("crates").setup(${toLuaObject cfg.extensions.crates-nvim.setupOpts}) - ''; - } - - # FIXME: this will not be necessary once crates.nvim creates a new release that - # ships improvements to the in-progress LSP module. If updating > 0.7.1, remember - # to update this section. - # See: - # - (mkIf withCompletion { - autocomplete.nvim-cmp.sources = {crates = "[Crates]";}; - }) - ]; + vim = mkMerge [ + { + startPlugins = ["crates-nvim"]; + pluginRC.rust-crates = entryAnywhere '' + require("crates").setup(${toLuaObject cfg.extensions.crates-nvim.setupOpts}) + ''; + } + ]; }) ]); } From 6ba72078e7401563fc25310e9799401f9c5812ed Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 26 Nov 2025 18:40:42 +0300 Subject: [PATCH 2/3] languages/astro: fix stdenv warning: move prettier out of `nodePackages` Signed-off-by: NotAShelf Change-Id: I87621112d9676fec2ad3b1ada98a433c6a6a6964 --- modules/plugins/languages/astro.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/plugins/languages/astro.nix b/modules/plugins/languages/astro.nix index a7742325..2cf6ee04 100644 --- a/modules/plugins/languages/astro.nix +++ b/modules/plugins/languages/astro.nix @@ -43,10 +43,10 @@ defaultFormat = ["prettier"]; formats = let - parser = "${self.packages.${pkgs.stdenv.system}.prettier-plugin-astro}/index.js"; + parser = "${self.packages.${pkgs.stdenv.hostPlatform.system}.prettier-plugin-astro}/index.js"; in { prettier = { - command = getExe pkgs.nodePackages.prettier; + command = getExe pkgs.prettier; options.ft_parsers.astro = "astro"; prepend_args = ["--plugin=${parser}"]; }; From 353ade5acc809697febeef1caa2c2a597224cd62 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 26 Nov 2025 18:57:35 +0300 Subject: [PATCH 3/3] flake: bump nixpkgs Signed-off-by: NotAShelf Change-Id: If1951d2d931ecea0846163075421ceba6a6a6964 --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 5a357a75..9e8b3eb5 100644 --- a/flake.lock +++ b/flake.lock @@ -53,11 +53,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1761880412, - "narHash": "sha256-QoJjGd4NstnyOG4mm4KXF+weBzA2AH/7gn1Pmpfcb0A=", + "lastModified": 1764081664, + "narHash": "sha256-sUoHmPr/EwXzRMpv1u/kH+dXuvJEyyF2Q7muE+t0EU4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a7fc11be66bdfb5cdde611ee5ce381c183da8386", + "rev": "dc205f7b4fdb04c8b7877b43edb7b73be7730081", "type": "github" }, "original": {