Skip to content

Commit 00e1a5a

Browse files
add opt to unset #[cfg(test)] in specified crates (#3156)
this allows the user to still enable #[cfg(test)] in rust-analyzer globally while not breaking dependencies that have different (broken) behavior when #[cfg(test)] is set. see: - rust-lang/rust-analyzer#7225 - lf-/rust-analyzer@86c9e7b
1 parent 293a438 commit 00e1a5a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clients/lsp-rust.el

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,12 @@ The command should include `--message=format=json` or similar option."
409409
:group 'lsp-rust-analyzer
410410
:package-version '(lsp-mode . "6.2.2"))
411411

412+
(defcustom lsp-rust-analyzer-cargo-unset-test []
413+
"force rust-analyzer to unset `#[cfg(test)]` for the specified crates."
414+
:type 'lsp-string-vector
415+
:group 'lsp-rust-analyzer
416+
:package-version '(lsp-mode . "6.2.2"))
417+
412418
(defcustom lsp-rust-analyzer-use-client-watching t
413419
"Use client watching"
414420
:type 'boolean
@@ -651,7 +657,8 @@ https://rust-analyzer.github.io/manual.html#auto-import.
651657
; Obsolete, but used by old Rust-Analyzer versions
652658
:loadOutDirsFromCheck ,(lsp-json-bool lsp-rust-analyzer-cargo-run-build-scripts)
653659
:autoreload ,(lsp-json-bool lsp-rust-analyzer-cargo-auto-reload)
654-
:useRustcWrapperForBuildScripts ,(lsp-json-bool lsp-rust-analyzer-use-rustc-wrapper-for-build-scripts))
660+
:useRustcWrapperForBuildScripts ,(lsp-json-bool lsp-rust-analyzer-use-rustc-wrapper-for-build-scripts)
661+
:unsetTest ,lsp-rust-analyzer-cargo-unset-test)
655662
:rustfmt (:extraArgs ,lsp-rust-analyzer-rustfmt-extra-args
656663
:overrideCommand ,lsp-rust-analyzer-rustfmt-override-command)
657664
:inlayHints (:typeHints ,(lsp-json-bool lsp-rust-analyzer-server-display-inlay-hints)

0 commit comments

Comments
 (0)