-
Notifications
You must be signed in to change notification settings - Fork 256
a way to give RLS environment settings #915
Comments
To be clear, you want a way to set environment variables passed to the RLS from VSCode? If so that is a fairly easy change to the VSCode plugin. Happy to give instructions if you want to make a PR. |
I don't know, is VSCode capable of loading a bat file to configure it's environment once it has been launched? As for a PR, I don't know Typescript nor Javascript at all (last time I've done something in JS was in the 90's to make stuff on mouse over… so you got an idea of my level in these languages ^^') |
Would it be enough to take a list of env vars and values and set them in the extension, rather than running a bat file? |
I may be enough, I'm not sure, the bat file is pretty big: |
My use case:
For now i don't have clear way how to provide this environment to RLS. It just says "Can't compile external crate" and no any features works |
Here's a quick 'n' dirty fix for setting RLS environment variables on Linux: (it's essentially just launching VSCode itself with the variables exported) export OPENSSL_INCLUDE_DIR=/usr/include/openssl-1.0
export OPENSSL_LIB_DIR=/usr/lib/openssl-1.0
code . It's not a great fix (or a viable long-term solution by any means), but it works. |
I don't think we should support an ad-hoc way to specify the environment inside the RLS itself - this doesn't solve the case of wrapper scripts (you wouldn't expect to run the I believe how you invoke RLS should be configured by the editors with rls-vscode supporting |
Some custom build scripts (especially for -sys packages) expect to query environment variables to locate build resources (such as pre-built binaries) but these cause lots of trouble when considering the numerous different ways in which cargo may be invoked. For example each editor that invokes cargo as part of providing development diagnostics needs to offer some way to configure environment variables or users need to find their own way of controlling the environment variables of these different tools which is burdensome and can lead to an inconsistent duplication of state across tools. This introduces support for reading an (optional) environment.json found at the root of the current workspace that may contain a map of environment variable key, value pairs. These variables will be exported to all build scripts run under the workspace. The removes any need to configure tools and editors independently. The configuration is separate from any Config.toml since it's likely that the state shouldn't be under version control in many situations (generally locating resources for the project within a specific user's development environment). Fixes: rust-lang/issues/4121 Fixes: rust-lang/rls/issues/915 Fixes: rust-lang/vscode-rust/issues/791 Fixes: rust-lang/rust-analyzer/pull/6099 Fixes: intellij-rust/intellij-rust/issues/1569
Some month ago, I faced some weird bugs in VSCode with extension stop working (no reference, no completion, no occurrence). I don't know how it was possible that it has ever work before as the fix was to launch VSCode in a shell with the environment being set, via a batch file:
So RLS has the proper MS tools to work with.
It's not very convenient nor straightforward and I'm opening this issue to try to improve RLS on this matter.
Any thought?
Thank you for reading :)
The text was updated successfully, but these errors were encountered: