From 32628135efca935203624ff9526bb0bcd42f714c Mon Sep 17 00:00:00 2001 From: Steven Taylor Date: Mon, 18 Nov 2024 19:03:33 +0000 Subject: [PATCH] feat: add flag for rust-analyzer.cfg.setTest (#4599) --- clients/lsp-rust.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clients/lsp-rust.el b/clients/lsp-rust.el index 48c17181fd..3df46423f8 100644 --- a/clients/lsp-rust.el +++ b/clients/lsp-rust.el @@ -616,6 +616,12 @@ which overrides any value that would otherwise be inherited from :group 'lsp-rust-analyzer :package-version '(lsp-mode . "9.0.0")) +(defcustom lsp-rust-analyzer-cfg-set-test t + "force rust-analyzer to set `#[cfg(test)]` for the current crate / workspace." + :type 'boolean + :group 'lsp-rust-analyzer + :package-version '(lsp-mode . "9.0.0")) + (defcustom lsp-rust-analyzer-use-client-watching t "Use client watching" :type 'boolean @@ -1698,6 +1704,7 @@ https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.m :files ( :exclude ,lsp-rust-analyzer-exclude-globs :watcher ,(if lsp-rust-analyzer-use-client-watching "client" "notify") :excludeDirs ,lsp-rust-analyzer-exclude-dirs) + :cfg ( :setTest ,(lsp-json-bool lsp-rust-analyzer-cfg-set-test) ) :cargo ( :allFeatures ,(lsp-json-bool lsp-rust-all-features) :noDefaultFeatures ,(lsp-json-bool lsp-rust-no-default-features) :features ,lsp-rust-features