Add rust-analyzer.serverEnv to set the environment variables of the server #6099
+14
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR simply adds a
rust-analyzer.serverEnv
settings in the VSCode extension to set the environment variables used when launching the rust-analyzer server.I don't know if it is a common use case, but I have a build script that depends on an environment variable to locate a system dependency. If the environment variable changes, the build script is re-run (which takes some time). The environment variables changes frequently, as I jump from version to version. I was setting the environment variable in the terminal of VS Code, but it kept re-running the build script because rust-analyzer was overiding the build script hash value. A quick fix was to launch VS Code from a terminal with the environment variable set, but it seemed like a nice feature to add without much effort needed, so there it is.