From 37aac453966129dc6636282fa44161fde60bf39b Mon Sep 17 00:00:00 2001 From: Christoph Koehler Date: Thu, 15 May 2025 11:36:15 -0600 Subject: [PATCH] fix: disable Conform for Rust if we have rust-analyzer enabled --- docs/release-notes/rl-0.8.md | 2 ++ modules/plugins/languages/rust.nix | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index f55b847c..a8a8d542 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -346,6 +346,8 @@ - Fix default telescope ignore list entry for '.git/' to properly match - Add [gitlinker.nvim] plugin to `vim.git.gitlinker-nvim` - Add [nvim-treesitter-textobjects] plugin to `vim.treesitter.textobjects` +- Default to disabling Conform for Rust if rust-analyzer is used + - To force using Conform, set `languages.rust.format.enable = true`. [rrvsh](https://github.com/rrvsh): diff --git a/modules/plugins/languages/rust.nix b/modules/plugins/languages/rust.nix index 677f7d3b..09c54ae6 100644 --- a/modules/plugins/languages/rust.nix +++ b/modules/plugins/languages/rust.nix @@ -7,7 +7,7 @@ inherit (builtins) attrNames; inherit (lib.meta) getExe; inherit (lib.modules) mkIf mkMerge; - inherit (lib.options) mkOption mkEnableOption; + inherit (lib.options) mkOption mkEnableOption literalMD; inherit (lib.strings) optionalString; inherit (lib.trivial) boolToString; inherit (lib.lists) isList; @@ -68,7 +68,14 @@ in { }; format = { - enable = mkEnableOption "Rust formatting" // {default = config.vim.languages.enableFormat;}; + enable = + mkEnableOption "Rust formatting" + // { + default = !cfg.lsp.enable && config.vim.languages.enableFormat; + defaultText = literalMD '' + Disabled if Rust LSP is enabled, otherwise follows {option}`vim.languages.enableFormat` + ''; + }; type = mkOption { description = "Rust formatter to use";