-
Notifications
You must be signed in to change notification settings - Fork 168
Pass environment variables to RLS #205
Comments
Hah, I ran into the EXACT same issue! Would love to hear someone more experienced with Rust give some idea about how to solve this. |
Same issue everyone, is there any way to make RLS run some .bat script or something? |
Right now this can be worked around using a wrapper script set in the #!/bin/bash
(>&2 echo "Running custom RLS wrapper")
RLS=rls
# Needs to pick up internal rustc libraries in the sysroot
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
# Set some extra env vars you'd like
export RUST_BACKTRACE=full
# Important to also forward all the arguments to the RLS binary
$RLS "$@" However I'd like to support that on a first-class level. |
Add a windows version for vscode @echo off
rustc --print sysroot > a:/tmp/temp-rls-msvc.txt
SET /p LD_LIBRARY_PATH=<a:/tmp/temp-rls-msvc.txt
SET RUST_BACKTRACE=full
SET "LIB=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64;"
rls %*
@echo on
|
Can we not having something like this to configure? "rust-client.environments": [
"OPENSSL_DIR": "/path/to/openssl",
"SSL_CERT_FILE": "/path/to/openssl/certs"
] |
@18601673727 maybe you can give https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer a try, it has a preference for extra environment variables. |
Thanks and I tried, but compares it to tls, I reckon it too weak to detect bugs I wrote in Rust, so for noobs like me, tls is the cure. Or would you mind enlighten me how to configure rust-analyzer as strict as rls? |
@18601673727 it should be just as strict as RLS, with the caveats that:
If you have any other problems, consider filing an issue over there. |
Thank you again for so many useful inputs!
in Should able to re-close sfackler/rust-openssl#1542 |
I'm having issues with projects that include
diesel
and use environment variables for instance:Results in the following in the output window:
Is there a way to pass environment variables to the RLS? Or maybe some path needs to be set so that
dotenv
can figure out the environmental variable.The text was updated successfully, but these errors were encountered: