Try out Rust IDE support in Visual Studio Code


Wow, great, and it works :smiley: Thank you very much. I was pretty sure there was no info about that in readme… but since it at least from 17 July, either I have installed it earlier, or didn’t pay much attention because at the time installation I had only anyway I’m really thankful for making it work for me again :wink:


Really nice :slight_smile:
How is RLS doing the formatting ? I am just wondering because I get different results for the same file when I use rustfmt or format on save with the extension.


Installed it, opened rustlings project and getting two errors: “Couldn’t start client Rust Language Server” and “Unexpected error initialising RLS - error running rustup”.

Please help.


what version of rustup are you using?

➜  ~  rustup --version
rustup 1.5.0 (92d0d1e9e 2017-06-24)


Might it have something to do with PATH? I had to configure PATH for other extensions I’ve used, ended up having this section which is now commented out

// "rust.racerPath": "/Users/kb/.cargo/bin/racer",
// "rust.rustfmtPath": "/Users/kb/.cargo/bin/rustfmt",
// "rust.rustsymPath": "/Users/kb/.cargo/bin/rustsym",
// "rust.rustLangSrcPath": "/Users/kb/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src",


I tried what you suggested but it didn’t actually help.
I’ve pasted the log into a gist here:

I hope it helps tracking down the problem. Right now it’s still not suggesting autocompletion nor jumping to definition.


It uses rustfmt. It is possible you’re still using the legacy (stable-compatible) version of rustfmt? (RLS uses rustfmt-nightly). It might also be just that the RLS is pinned to a slightly more or less up to date version of rustfmt.


You don’t need any paths set, you just need to be able to ‘see’ rustup from vscode (the version looks up to date to me, btw). If you can run rustup from the console, you could try running code from there too - you should then get exactly the same environment.


I think you might be having issues because you have both a bin and lib crate in the project. Try setting rust.build_lib to true in your VSCode settings (this won’t be necessary in the future, hopefully).


Didn’t help, unfortunately. Is there a way to debug this somehow to see why exactly it can’t start?

I just created an empty project via cargo new vscode-test --bin, fails the same way.


I just wrote some advice on debugging - Some of that might be useful.

So just to clarify, you can run rustup --version from the terminal, then from the same terminal run code, and it still gives the ‘can’t find rustup’ error?


Is it possible to get rls nightly updated? It’s still sitting on rls 0.1.0-nightly (5d4bbd9 2017-08-07), see


There’s a PR in the queue to do that, just waiting for it to land. Hopefully, that will be in today’s nightly, but it is cutting a bit fine, might be tomorrow.


Ah, thanks. Could you link to that PR? I don’t even know what repo to look


Sure -


Hm, I seem to have the analysis running continuously. And the crate’s not all that big. Will try to run with logs tomorrow, but I don’t know what to look for.


… but after I turned on logging I can’t reproduce it and it seems to behave just fine.


It seems like RLS performance issues are fixed (it was unusable before), thanks a lot! I’m using it with neovim, and works fast so far.


Has anyone else found that you can’t install rls on nightly while it works on stable?

$ rustup component add rls-preview
error: toolchain 'nightly-x86_64-unknown-linux-gnu' does not contain component 'rls-preview' for target 'x86_64-unknown-linux-gnu'

$ rustup default stable           
info: using existing install for 'stable-x86_64-unknown-linux-gnu'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.21.0 (3b72af97e 2017-10-09)

$ rustup component add rls-preview
info: downloading component 'rls-preview'
  3.9 MiB /   3.9 MiB (100 %) 755.3 KiB/s ETA:   0 s                
info: installing component 'rls-preview'

EDIT: it appears this is because the component is called rust-analysis on nightly. Is this discrepancy deliberate?