From ad13549beb0bfb18e7205a789026dd127049fe99 Mon Sep 17 00:00:00 2001 From: Samuel Cobb Date: Fri, 5 Jun 2026 04:06:23 +0100 Subject: [PATCH] feat(rust): add assertion and comment on configuration --- configuration.nix | 3 ++- modules/plugins/languages/rust.nix | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/configuration.nix b/configuration.nix index 3a29e8fe..8182b06e 100644 --- a/configuration.nix +++ b/configuration.nix @@ -74,7 +74,8 @@ isMaximal: { typst.enable = isMaximal; rust = { enable = isMaximal; - extensions.rustaceanvim.enable = isMaximal; + # Can only be enabled if lsp.enable = false + extensions.rustaceanvim.enable = false; extensions.crates-nvim.enable = isMaximal; }; toml.enable = isMaximal; diff --git a/modules/plugins/languages/rust.nix b/modules/plugins/languages/rust.nix index e20d8629..136a01b6 100644 --- a/modules/plugins/languages/rust.nix +++ b/modules/plugins/languages/rust.nix @@ -282,11 +282,6 @@ in { (mkIf cfg.extensions.rustaceanvim.enable { vim = { - # TODO: Determine if mkForce is the best thing here, and if we should consider a warning instead? Or use priority settings. - lsp.servers.rust-analyzer.enable = lib.mkForce false; - lsp.servers.rust-analyzer.root_dir = lib.mkForce null; # let rustaceanvim determine root - lsp.servers.rust-analyzer.on_attach = lib.mkForce null; # let rustaceanvim determine attach funcs - startPlugins = ["rustaceanvim"]; pluginRC.rustaceanvim = entryAfter ["lsp-setup"] '' vim.g.rustaceanvim = function() @@ -294,6 +289,13 @@ in { end ''; }; + + assertions = [ + { + assertion = !cfg.lsp.enable; + message = "rustaceanvim and vim.languages.rust.lsp.enable are mutually exclusive. Please ensure `vim.lsp.rust-analyzer.enable` is false, or disable `vim.languages.rust.lsp.enable`."; + } + ]; }) (mkIf cfg.extensions.crates-nvim.enable {