Visual studio code and rust

Hello.
I'd like to use visual studio code as IDE for rust but for some reason it is not easy. :slight_smile:
What I need to install/add to have rust intellisense inside visual studio code?
Every time I open folder with rust project created with cargo new I have this:


Meaning it says that rls is not installed but when I click on "Yes" to install it does not change anything because next time I have the same. :frowning:. Can anybody tell me what I need to successfully run this combo?
Opensuse linux, vsc 1.44, rustup default set to nightly because I was not able to install racer which is responsible for code completion if internet is right.

Thank you for your help. :slight_smile:

I think for Visual Studio Code the normal RLS doesn't suffice. Try this one.

If you click on the View -> Output menu option, are there any error messages in any of the output windows? You can switch between them with the drop down on the right.

OK seems we have progress :slight_smile: after I did:
rustup component add rls rust-analysis rust-src
the only warning I get is this:

To properly function, the extension needs to know what toolchain you want to use
Rust

the same as in that above picture in right bottom corner.
So how can I "tell" this extension which toolchain I want to use? :slight_smile:

edit:
Here is the solution to my latest question add these lines to settings.json:
"rust.rustup": "nightly-x86_64-unknown-linux-gnu",
"rust.mode": "rls",
Thank you and best regards. :slight_smile:

The topic seems to be solved but I still want to mention the alternative rust-analyzer.

Recently, I switched from the RLS to rust-analyzer mainly because of the faster responses. Especially, when you project gets big I experienced that RLS really slows down the development flow.

Furthermore, you can install rust-analyzer just as any other extension in VSC via the marketplace. It will even tell you when a new version is available and updating requires just pushing the Ok button.

You should be aware that rust-analyzer is still in experimental phase and some things might not work correctly. In the month I'm using it, however, I didn't recognized anything harmful and RLS isn't sometimes better anyway.

1 Like

I use coc-rust-analyzer for Vim. It's awesome. Can confirm.