I just published racer 2.1.0.
This version includes new features such as
- support macros in std lib
and many bug fixes, so I highly recommend to update.
But from this version raced needs nightly rust and some package dependencies, so please check README before updateing.
From the README:
Racer is used as a static library in RLS
Could you explain this more? Is racer a dependency of RLS then? I’m just curious how the two are related and what use cases one fills vs. the other. I was under the impression the RLS was sort of the community project in this area now.
RLS uses racer as a library.
yay! so if I use RLS, I don’t need to update/install racer, do I?
Okay, got it thanks. So for tools that don’t (want to) implement the Language Server Protocol, you can write your own plugin directly to Racer, which is lower in the stack.
Also saw from the RLS docs:
The RLS gets its source data from the compiler and from Racer. Where possible it uses data from the compiler which is precise and complete. Where it is not possible, (for example for code completion and where building is too slow), it uses Racer.
Does this imply that Racer is more “lossy” than what RLS can get directly from the compiler?
Yep, Racer is used for things like autocompletion that need to run quickly but can be approximate, and RLS talks to the compiler for things like method usage locations.
Yeah. But sometimes it can be merit to be ‘lossy’ because auto completion tool often have to work in a incomplete code, like
let a = Vec:.
Indeed, I think to work with rls-analysis is important future work
Another major difference is the mode of operation of compiler and racer backends. Currently, compiler can only produce the save analysis data for the whole crate at once. Even if you are interested only in the data for the single function you are currently editing, you’ll have to process save analysis for the whole world. In contrast, if I understand correctly, Racer is more on-demand and is closer to IntelliJ in this respect (but it dose approximate partially regex-based analysis (I think, not sure about this one!)).
And, as @kngwyu said, error tolerance is also important: it’s not too hard to completely break the compilation, which makes save-analysis useless.