rust-lang / vscode-rust

Rust extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
Other
1.39k stars 167 forks source link

couldn't start client Rust Language Server #622

Open billtlee opened 5 years ago

billtlee commented 5 years ago

Hi,

I just installed the 0.61 plugin and am running into the "couldn't start client rust language server" error. I have put the "rust-client.channel": "stable" into my settings.json and can run rustup from terminal spawned inside vsc. Please see the attached screenshot. Any idea on how to resolve this? Screen Shot 2019-07-07 at 11 19 28 AM

billtlee commented 5 years ago

Nevermind, I quit code and restarted it and it's now working.

geropl commented 4 years ago

I had the same error with rust-client.channel being undefined. It's especially bad with first time (Rust/vscode) users. It would really help to have a default stable.

leiz-me commented 4 years ago

I had the same issue. And vscode kept telling me "rls building".

After I set up the "rust-client.channel" and "rust-client.rustupPath" manually, both problems are solved. Perhaps this would be helpful.

parrotdance commented 4 years ago

Add this line to setting.json might solve this problem: "rust-client.rustupPath": "$HOME/.cargo/bin/rustup" If you change the path during installation, just replace it with your own path. btw, the default value is rustup, this is obviously not available.

I am using macOS catalina, but I think it should work at most of UNIX-like OS.

jerrygreen commented 4 years ago

I had this error, and @parrotdance thanks for your solution, it works! A little bit weird it's not working out of the box, though...

samuela commented 4 years ago

@parrotdance Thanks! For others on the struggle bus, I found that you have to restart/reload VSCode for the setting to kick in.

parrotdance commented 4 years ago

@JerryGreen Search rustup path in setting and it will show you a elegant way. The real weird stuff is, the default value works well in Windows, anyone gonna resolve this?

carycodes commented 4 years ago

If this is a problem with macOS then it's probably down to the weird way that macOS handles $PATH. Specifically, the value that gets loaded for an app launched from dock or spotlight is not the same as the value that gets loaded for a terminal session. Under normal (default) install conditions, VSCode on macOS will not be able to find rustup.

chris73it commented 4 years ago

I am on Windows 10 (May 2020 release 2004) and I am experiencing the same issue.

toknsi commented 3 years ago

I am on Windows 10 (May 2020 release 2004) and I am experiencing the same issue.

if wsl choose config of remote wsl image

eutobias commented 3 years ago

Everything works fine for me after add this:

{ "rust-client.channel": "stable", "rust-client.rustupPath": "$HOME/.cargo/bin/rustup" }

to my config, i´m using Ubuntu 20 with WSL2 on windows 10

prosenboim commented 3 years ago

Same on Fedora 31. I installed rust from package manager, so I have no rustup in the system.

woss commented 3 years ago

i've solved it setting this in the local settings.json file "rust-client.disableRustup": true

danawoodman commented 3 years ago

"rust-client.channel": "stable" seemed to be the magic sauce for me, thanks @eutobias 🎉

Too bad this isn't working out of the box 😢

Emmanuerl commented 3 years ago

Nevermind, I quit code and restarted it and it's now working.

Thanks. This worked for me.

0x1af2aec8f957 commented 3 years ago

If you use brew installation, configure it in settings.json as follows:

{
    // Rust configure
    "rust-client.channel": "stable", // Channel
    "rust-client.rlsPath": "/opt/homebrew/opt/rust-analyzer/bin/rust-analyzer", // Language server
    "rust-client.disableRustup": true,
    // "rust-client.rustupPath": "$HOME/.cargo/bin/rustup",
}
flodiebold commented 3 years ago

@0x1af2aec8f957 to use rust-analyzer, please use the rust-analyzer extension right now. The VSCode-Rust extension doesn't work very well with RA at the moment.

coffeedome commented 3 years ago

I guess in addition to the answers above you can also just run the below as sudo (assuming here you're on a Mac):

$HOME/.cargo/bin/rustup component add rust-analysis --toolchain stable 
$HOME/.cargo/bin/rustup component add rust-src --toolchain stable 
$HOME/.cargo/bin/rustup component add rls --toolchain stable 
lnicola commented 3 years ago

You probably shouldn't run rustup with sudo, since it sets up per-user toolchains, so you'll get one installed for root.

tan-wei commented 2 years ago

I met this issue with Windows today. Before yesterday, it worked quite well.

After I manual add path of rust in ENV, it is solved.