Skip to content

Commit fd0a4f1

Browse files
vibhavpjcs090218
andauthored
rust-analyzer: Add defcustoms for extra args and env vars to cargo. (#4015)
* rust-analyzer: Add defcustoms for extra args and env vars to cargo. * lsp-rust-analyzer-cargo-extra-args, lsp-rust-analyzer-cargo-extra-env: New config variables for lsp-rust-analyzer. * lsp-rust-analyzer--make-init-options: Set fields cargo.extraArgs and cargo.extraEnv from lsp-rust-analyzer-cargo-extra-args and lsp-rust-analyzer-cargo-extra-env respectively. * fix: conflict * Resolve conflict --------- Co-authored-by: Jen-Chieh Shen <jcs090218@gmail.com>
1 parent 3422c85 commit fd0a4f1

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

clients/lsp-rust.el

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,19 @@ or JSON objects in `rust-project.json` format."
829829
:group 'lsp-rust-analyzer
830830
:package-version '(lsp-mode . "8.0.0"))
831831

832+
(defcustom lsp-rust-analyzer-cargo-extra-args []
833+
"Extra arguments that are passed to every cargo invocation."
834+
:type 'lsp-string-vector
835+
:group 'lsp-rust-analyzer
836+
:package-version '(lsp-mode . "8.0.1"))
837+
838+
(defcustom lsp-rust-analyzer-cargo-extra-env []
839+
"Extra environment variables that will be set when running cargo, rustc or
840+
other commands within the workspace. Useful for setting RUSTFLAGS."
841+
:type 'lsp-string-vector
842+
:group 'lsp-rust-analyzer
843+
:package-version '(lsp-mode . "8.0.1"))
844+
832845
(defconst lsp-rust-notification-handlers
833846
'(("rust-analyzer/publishDecorations" . (lambda (_w _p)))))
834847

@@ -1664,6 +1677,8 @@ https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.m
16641677
:cargo ( :allFeatures ,(lsp-json-bool lsp-rust-all-features)
16651678
:noDefaultFeatures ,(lsp-json-bool lsp-rust-no-default-features)
16661679
:features ,lsp-rust-features
1680+
:extraArgs ,lsp-rust-analyzer-cargo-extra-args
1681+
:extraEnv ,lsp-rust-analyzer-cargo-extra-env
16671682
:target ,lsp-rust-analyzer-cargo-target
16681683
:runBuildScripts ,(lsp-json-bool lsp-rust-analyzer-cargo-run-build-scripts)
16691684
;; Obsolete, but used by old Rust-Analyzer versions
@@ -1745,7 +1760,6 @@ https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.m
17451760
:download-server-fn (lambda (_client callback error-callback _update?)
17461761
(lsp-package-ensure 'rust-analyzer callback error-callback))))
17471762

1748-
17491763
(lsp-consistency-check lsp-rust)
17501764

17511765
(provide 'lsp-rust)

0 commit comments

Comments
 (0)