-
Notifications
You must be signed in to change notification settings - Fork 1.7k
setting rust-analyzer.cargo.extraEnv.key = null
has no effect
#19626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
it likely does, and as such, the environment passed to cargo is unchanged (that is whatever is inherited). The config only adds to that environment. We should support setting env keys to |
So,
FxHashMap<String, Option<String>>
Here we need to also insert an extra entry for that type (but keep the previous) rust-analyzer/crates/rust-analyzer/src/config.rs Lines 3222 to 3224 in a09a550
And the rest the compiler should guide one through via diagnostics. |
@Veykril should we also improve the config parsing to log an error when it can’t deserialize the environment? |
Well we should already either log them or show them in the status bar item, so if we don't that's a bug somewhere. |
i think the bug is that rust-analyzer/crates/rust-analyzer/src/config.rs Lines 3094 to 3098 in a09a550
|
ok yeah that fixed it, i'll make a pr |
rust-analyzer version: rust-analyzer version: 0.3.2379-standalone (8365cf8 2025-04-13) [/home/jyn/.vscode/extensions/rust-lang.rust-analyzer-0.3.2379-linux-x64/server/rust-analyzer]
rustc version (eg. output of
rustc -V
): rustc 1.88.0-nightly (78f2104e3 2025-04-16)editor or extension: VSCode 1.96.2 (fabdb6a30b49f79a7aba0f2ad9df9b399473380f), extension version 0.3.2379
relevant settings:
repository link (if public, optional): N/A; happens on every project i've tried
code snippet to reproduce: N/A
if i run strace on rust-analyzer, i see this output:
i expect ENV to be unset here, since i've explicitly unset it in the config file.
i tracked through a bunch of the RA codebase but couldn't figure out why this happens. the typescript extension passes it through unchanged, i see
extraEnv: { ENV: null }
in the typescript output. the "rust-analyzer Language Server" "output" panel showsServer process exited with code 0.
, which is odd because the LSP is working fine, goto-definition etc work fine.i found that this config is parsed into
cargo_extraEnv: FxHashMap<String, String>
usingget_field_json
, and i would have expected that function to return an error given thatserde_json::from_value::<String>(null)
returns an error. but i don't see that anywhere in the logs.The text was updated successfully, but these errors were encountered: