rust/crates
bors 11bf2e7ffb Auto merge of #13058 - dpaoliello:extraenv, r=Veykril
Add a new configuration settings to set env vars when running cargo, rustc, etc. commands: cargo.extraEnv and checkOnSave.extraEnv

It can be extremely useful to be able to set environment variables when rust-analyzer is running various cargo or rustc commands (such as `cargo check`, `cargo --print cfg` or `cargo metadata`): users may want to set custom `RUSTFLAGS`, change `PATH` to use a custom toolchain or set a different `CARGO_HOME`.

There is the existing `server.extraEnv` setting that allows env vars to be set when the rust-analyzer server is launched, but using this as the recommended mechanism to also configure cargo/rust has some drawbacks:
- It convolutes configuring the rust-analyzer server with configuring cargo/rustc (one may want to change the `PATH` for cargo/rustc without affecting the rust-analyzer server).
- The name `server.extraEnv` doesn't indicate that cargo/rustc will be affected but renaming it to `cargo.extraEnv` doesn't indicate that the rust-analyzer server would be affected.
- To make the setting useful, it needs to be dynamically reloaded without requiring that the entire extension is reloaded. It might be possible to do this, but it would require the client communicating to the server what the overwritten env vars were at first launch, which isn't easy to do.

This change adds two new configuration settings: `cargo.extraEnv` and `checkOnSave.extraEnv` that can be used to change the environment for the rust-analyzer server after launch (thus affecting any process that rust-analyzer invokes) and the `cargo check` command respectively. `cargo.extraEnv` supports dynamic changes by keeping track of the pre-change values of environment variables, thus it can undo changes made previously before applying the new configuration (and then requesting a workspace reload).
2022-09-18 17:43:46 +00:00
..
base-db Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
cfg
flycheck Add cargo.extraEnv setting 2022-09-13 11:29:14 -07:00
hir Auto merge of #13225 - lowr:fix/hir-proj-normalization, r=Veykril 2022-09-13 14:52:58 +00:00
hir-def Fix prelude injection 2022-09-15 12:12:22 +02:00
hir-expand Auto merge of #13167 - iDawer:exhaustive_patterns, r=Veykril 2022-09-02 12:32:36 +00:00
hir-ty Auto merge of #13225 - lowr:fix/hir-proj-normalization, r=Veykril 2022-09-13 14:52:58 +00:00
ide Auto merge of #13221 - mdx97:mdx97/annotations-above-whole-item, r=Veykril 2022-09-13 15:09:53 +00:00
ide-assists Auto merge of #13227 - Veykril:core-pref, r=Veykril 2022-09-13 13:16:57 +00:00
ide-completion Complete variants and assoc items in path pattern through type aliases 2022-09-16 16:11:58 +02:00
ide-db Use memmem when searching for usages in ide-db 2022-09-16 16:26:54 +02:00
ide-diagnostics Fix tests by using primitive rather than String. 2022-09-16 16:56:19 -05:00
ide-ssr Add config to unconditionally prefer core imports over std 2022-09-09 20:04:56 +02:00
limit Properly cfg the max field of Limit 2022-07-31 19:27:20 +02:00
mbe mbe: Remove unneeded unwrap 2022-09-14 23:49:08 +02:00
parser Auto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon, r=jonas-schievink 2022-09-01 21:00:14 +00:00
paths Auto merge of #12808 - Veykril:check-workspace, r=Veykril 2022-08-04 12:57:04 +00:00
proc-macro-api remove imports that are also in edition 2021's prelude 2022-08-09 01:16:32 +02:00
proc-macro-srv Replace crossbeam with std's scoped threads 2022-08-22 14:55:13 +02:00
proc-macro-srv-cli Gate and rename binary, use it if it's in the sysroot 2022-07-25 16:22:39 +02:00
proc-macro-test revert nightly rustfmt formatting that accidentally slipped in 2022-07-25 14:18:30 +02:00
profile
project-model Add cargo.extraEnv setting 2022-09-13 11:29:14 -07:00
rust-analyzer Auto merge of #13058 - dpaoliello:extraenv, r=Veykril 2022-09-18 17:43:46 +00:00
sourcegen run stable fmt through rustup 2022-08-06 17:25:02 +03:00
stdx Update test fixtures 2022-08-25 21:07:24 +02:00
syntax Fmt 2022-09-02 21:18:36 +00:00
test-utils Implement IntoFuture type inference 2022-08-08 21:05:56 -04:00
text-edit
toolchain
tt
vfs Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
vfs-notify Bump notify 2022-08-19 21:37:05 +03:00