vscode-rust icon indicating copy to clipboard operation
vscode-rust copied to clipboard

RLS using remote-ssh fails to run

Open Nokel81 opened this issue 4 years ago • 10 comments

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.

Nokel81 avatar Feb 07 '20 16:02 Nokel81

I have the same problem. Do you know how to fix it now?

BruceChen2017 avatar Apr 16 '20 12:04 BruceChen2017

Nope, I never got it to work.

Nokel81 avatar Apr 16 '20 13:04 Nokel81

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 avatar Apr 17 '20 05:04 BruceChen2017

@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.

TheNetAdmin avatar Apr 25 '20 22:04 TheNetAdmin

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

ghost avatar Jan 09 '21 05:01 ghost

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"

shotor avatar Apr 11 '21 12:04 shotor

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.

tonimelisma avatar May 05 '21 21:05 tonimelisma

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 avatar May 05 '21 21:05 tonimelisma

@tonimelisma you can also try rust-analyzer which should support VS Code Remote.

lnicola avatar May 06 '21 09:05 lnicola

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).

ku1ik avatar Aug 15 '21 18:08 ku1ik