Skip to content

Commit d9057bf

Browse files
authored
lsp-rust: add lsp-rust-analyzer-cargo-target-dir config (#4870)
Allow setting the config option to have RA put its build artefacts in a separate dir.
1 parent 70b3e6c commit d9057bf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

clients/lsp-rust.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,20 @@ belongs to."
566566
:group 'lsp-rust-analyzer
567567
:package-version '(lsp-mode . "8.0.0"))
568568

569+
(defcustom lsp-rust-analyzer-cargo-target-dir nil
570+
"Optional path to a rust-analyzer specific target directory.
571+
This prevents rust-analyzer's `cargo check` and initial build-script and
572+
proc-macro building from locking the `Cargo.lock` at the expense of
573+
duplicating build artifacts.
574+
575+
Set to `true` to use a subdirectory of the existing target directory or
576+
set to a path relative to the workspace to use that path."
577+
:type '(choice
578+
(string :tag "Directory")
579+
boolean)
580+
:group 'lsp-rust-analyzer
581+
:package-version '(lsp-mode . "8.0.0"))
582+
569583
(defcustom lsp-rust-analyzer-cargo-watch-enable t
570584
"Enable Cargo watch."
571585
:type 'boolean
@@ -1717,6 +1731,7 @@ https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.m
17171731
:extraArgs ,lsp-rust-analyzer-cargo-extra-args
17181732
:extraEnv ,lsp-rust-analyzer-cargo-extra-env
17191733
:target ,lsp-rust-analyzer-cargo-target
1734+
:targetDir ,lsp-rust-analyzer-cargo-target-dir
17201735
:runBuildScripts ,(lsp-json-bool lsp-rust-analyzer-cargo-run-build-scripts)
17211736
;; Obsolete, but used by old Rust-Analyzer versions
17221737
:loadOutDirsFromCheck ,(lsp-json-bool lsp-rust-analyzer-cargo-run-build-scripts)

0 commit comments

Comments
 (0)