Skip to content

Commit

Permalink
add opt to unset #[cfg(test)] in specified crates
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cassandracomar committed Oct 18, 2021
1 parent 8fe3f3a commit 751d8b8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion clients/lsp-rust.el
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,12 @@ The command should include `--message=format=json` or similar option."
:group 'lsp-rust-analyzer
:package-version '(lsp-mode . "6.2.2"))

(defcustom lsp-rust-analyzer-cargo-unset-test []
"force rust-analyzer to unset `#[cfg(test)]` for the specified crates."
:type 'lsp-string-vector
:group 'lsp-rust-analyzer
:package-version '(lsp-mode . "6.2.2"))

(defcustom lsp-rust-analyzer-use-client-watching t
"Use client watching"
:type 'boolean
Expand Down Expand Up @@ -651,7 +657,8 @@ https://rust-analyzer.github.io/manual.html#auto-import.
; Obsolete, but used by old Rust-Analyzer versions
:loadOutDirsFromCheck ,(lsp-json-bool lsp-rust-analyzer-cargo-run-build-scripts)
:autoreload ,(lsp-json-bool lsp-rust-analyzer-cargo-auto-reload)
:useRustcWrapperForBuildScripts ,(lsp-json-bool lsp-rust-analyzer-use-rustc-wrapper-for-build-scripts))
:useRustcWrapperForBuildScripts ,(lsp-json-bool lsp-rust-analyzer-use-rustc-wrapper-for-build-scripts)
:unsetTest ,lsp-rust-analyzer-cargo-unset-test)
:rustfmt (:extraArgs ,lsp-rust-analyzer-rustfmt-extra-args
:overrideCommand ,lsp-rust-analyzer-rustfmt-override-command)
:inlayHints (:typeHints ,(lsp-json-bool lsp-rust-analyzer-server-display-inlay-hints)
Expand Down

0 comments on commit 751d8b8

Please sign in to comment.