Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I solve "Couldn't start client Rust Language Server" with the Rust VS Code extension?

After installing the Rust extension for VS Code, building the project fails with the following error:

Error Message Displayed by vscode

Couldn't start client Rust Language Server

Rustup not available. Install from https://www.rustup.rs

This is in spite of the fact that rustup is installed in the system, and accessible from the VS Code terminal.

like image 928
suj1th Avatar asked Mar 23 '20 15:03

suj1th


People also ask

How do I use rust code in Visual Studio?

To install the Rust extension in VS Code follow the following steps: Step 1: Open Visual Studio Code. Step 2: Go to the Extension panel and install the rust-analyzer extension by clicking on the Install button or we can use Ctrl+Shift+X. Step 3: For Debugging support install the CodeLLdb Extension by extension menu.

How do I add rust to Visual Studio?

First, download and install Visual Studio Code for Windows. After you've installed VS Code, install the rust-analyzer extension. You can either install the rust-analyzer extension from the Visual Studio Marketplace, or you can open VS Code, and search for rust-analyzer in the extensions menu (Ctrl+Shift+X).


3 Answers

This is an oft-reported issue in the rls-vscode repository, and I found the solution buried in some of the discussions (1, 2).

The issue seems to be with the path to the rustup executable. rustup works fine on the terminal, but VS Code cannot locate it.

Adding the following to the setting.json of the extension fixes the path for the extension.

"rust-client.rustupPath": "/home/XXX/.cargo/bin/rustup"
like image 107
suj1th Avatar answered Oct 13 '22 02:10

suj1th


@suj1th first cited approach fixed it for me.
Add: "rust-client.rustupPath": "$HOME/.cargo/bin/rustup" to your user settings.

like image 26
Justin Avatar answered Oct 13 '22 03:10

Justin


Here is a debugging/troubleshooting guide: https://github.com/rust-lang/rls/blob/master/debugging.md

My fix was to launch VSCode from the terminal with code.

like image 1
Mark Jackson Avatar answered Oct 13 '22 02:10

Mark Jackson