Windows / rls slow

#1

When I open a rust project in vscode, or vim, the IDE is extremely slow in marking errors.

Changes take around 5-10 seconds to propagate.

A typescript project (which also uses language-server), is nearly instantaneous, or at least under a second or so.

This wouldn’t be so bad if I was good at rust - make a bunch of changes and let the IDE correct me when I have a moment to think about it.

But as a part-time Rust learner who’s trying to let the compiler teach me, this is almost unbearable… I need the constant feedback and iteration. These 5-10 seconds end up costing me hours in frustration.

I vaguely remember it being bad on linux as well - but maybe not as bad… I see from various google searches that it’s a problem others encounter, but then core team members like @steveklabnik seem to be developing on Windows and I’m sure on very large projects - so something must be off here.

I’ve tried lots of things… updated rls, tinkered with some settings (like turning racer off), etc.

For what it’s worth, cargo check is very quick… MUCH quicker (on incremental rebuilds) than the IDE/rls!

Any help is appreciated!!

#2

I guess this is not much help, but on linux it feels slow too. Not only on start, but during normal use.

What I’ve noticed is, while rustc tries to be multithreaded and compiles multiple jobs at once, RLS seems to be taking just one CPU all the time. I’m pretty sure this’ll be addressed eventually, but I don’t know when that would be.

As a workaround, I sometimes keep the cargo watch running in another window.

#3

geez… this is especially awful since one of the best ways to learn rust is via the compiler :\

don’t want to be that guy who just complains without offering a solution, but this is a really big deal imho.

so you work by keeping your eye on that other window, paying attention to errors and line numbers, then fixing them in the ide?

#4

Well, I’m old-school so the IDE is actually vim, and I’m used to not having much assistance from there. Errors appearing after a while or having to look into another window and fixing the errors by that is actually improvement over what I’ve been using most of my life in the C/C++ world. In that context, slow RLS is just a minor annoyance for me and a great thing when it works fast. I’ve been using Rust at times when RLS didn’t exist yet. I’ve learned not to write too many errors :innocent:.

But I do agree having it fast would be great improvement. And it seems people are looking into it: https://github.com/rust-lang/rls/labels/latency

#5

I’m also using vim, and the assistance from Neoclide is amazing! Pretty much matches VSCode

If only it were fast :frowning:

#6

For the time being, you could try intellij-rust. I find it pretty responsive (they have their own Rust grammar parser written in Kotlin).

There is a Vim emulation plugin available as well: https://plugins.jetbrains.com/plugin/164-ideavim

2 Likes
#7

I installed intellij-rust but it didn’t catch any errors for me upon re-save

I wonder if altogether this is an issue with cargo workspaces?

Also thinking that just running cargo check on save, triggered via some watcher like chokidar-cli, could be helpful (since cargo check is fast) … won’t be in the ide, but at least good info…

#8

You can enable this in intellij-rust and get highlighting in the IDE pane (it’s just not on by default):

rust2