After installing the Rust
extension for VS Code, building the project fails with the following error:
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.
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.
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).
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"
@suj1th first cited approach fixed it for me.
Add: "rust-client.rustupPath": "$HOME/.cargo/bin/rustup"
to your user settings.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With