vscode-rust
vscode-rust copied to clipboard
RLS using remote-ssh fails to run
I am using remote-ssh to develop on a different machine. But when I open my rust project the following errors appear:
Couldn't start client Rust Language Server
Rustup not available. Install from https://www.rustup.rs/
But if I open the terminal (using "new terminal") I see that I am indeed in a terminal on my remote machine and if I do rustup --version
I get rustup 1.21.1 (7832b2ebe 2019-12-20)
as output.
I have the same problem. Do you know how to fix it now?
Nope, I never got it to work.
I got it to work! It would not work if export PATH="$PATH:/path/to/cargo/bin"
is in .zshrc
. If export PATH="$PATH:/path/to/cargo/bin"
is set in /etc/profile
, it works now.After that, if you have problem that rls is always building, check this.
@BruceChen2017 Your solution works for me, thanks!
I think the reason may be the RLS extension try to invoke sh
in some command, and thus not aware of .bashrc
settings, etc.
This is only a guess.
Same here. My guess is vscode remote-ssh starts using a non-interactive non-login shell. Its PATH variable is difference from the one we actual use.
echo $PATH in the remote machine: /usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
echo $PATH using the shell brough up by vscode remote-ssh /root/.vscode-server-insiders/bin/ed6c343edb720d91ee0859e566c84b5687f5a9d5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Above didn't work for me. Path is correct on my machine.
Adding this to remote user settings did the trick.
"rust-client.rustupPath": "~/.cargo/bin/rustup"
This is still a bug for me. A default install of rust on Ubuntu doesn't work with the vscode rust extension. Unclear whether this bug should be raised upstream in the rust installer (which edits PATH in .profile/.bashrc but not in any initialisation files used by /bin/sh) or in this repository.
Further complicated by the fact that /bin/sh on Ubuntu is dash which doesn't have a non-interactive .shrc file, only .profile but it's run only for interactive shells.
Yet this is clearly a bug. A vendor-managed default install of the software should be recognised by a vendor-supplied vscode extension.
Not sure what's happened but the workaround of defining the rustup path settings.json doesn't work, "rust-client.rustupPath"
isn't a recognised configuration key. Perhaps the extension has been updated.
Luckily rustup self uninstall
works anyway 👏 Back to my beloved go
I guess
@tonimelisma you can also try rust-analyzer
which should support VS Code Remote.
rust-client.rustupPath
suggestion from @shotor did the trick for me 👍 Note you need to close all remote ssh connections for this to take effect (easiest to restart whole VS Code).