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

couldn't start client Rust Language Server

Open billtlee opened this issue 5 years ago • 20 comments

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 avatar Jul 07 '19 03:07 billtlee

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

billtlee avatar Jul 07 '19 03:07 billtlee

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.

geropl avatar Jul 26 '19 12:07 geropl

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.

leiz-me avatar Oct 24 '19 03:10 leiz-me

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.

parrotdance avatar Dec 04 '19 11:12 parrotdance

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

jerrygreen avatar Jan 09 '20 09:01 jerrygreen

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

samuela avatar Jan 24 '20 23:01 samuela

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

parrotdance avatar Feb 27 '20 08:02 parrotdance

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.

carycodes avatar Mar 31 '20 16:03 carycodes

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

chris73it avatar Jun 19 '20 00:06 chris73it

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

  • install rls
  • config rustupPath

if wsl choose config of remote wsl image

toknsi avatar Aug 02 '20 01:08 toknsi

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

eutobias avatar Sep 02 '20 15:09 eutobias

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

prosenboim avatar Oct 18 '20 11:10 prosenboim

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

woss avatar Dec 02 '20 20:12 woss

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

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

danawoodman avatar Jan 15 '21 03:01 danawoodman

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

Thanks. This worked for me.

Emmanuerl avatar May 10 '21 12:05 Emmanuerl

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",
}

0x1af2aec8f957 avatar Jun 15 '21 07:06 0x1af2aec8f957

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

flodiebold avatar Jun 15 '21 08:06 flodiebold

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 

coffeedome avatar Jul 11 '21 19:07 coffeedome

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

lnicola avatar Jul 11 '21 19:07 lnicola

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.

tan-wei avatar Feb 24 '22 13:02 tan-wei