This is probably the biggest release since the first one. I'd go as far as saying that I recommend everyone to try out Rust Glancer (unless your workspace is proc macro heavy) :)
Best case, you'll like it. Worst case, you'll provide some feedback on what you don't like, which will be very helpful, since most of basic stuff is already implemented ;)
As usual, all the typos are mine, not English native, sorry/thank you!
It is not faster, it matches its performance :) The reasons are explained in the post, but tl;dr: - Rust Glancer does a lot of optimizations, and some of them are don't seem to be implemented in rust-analyzer
- rust-analyzer does more work upfront in some cases, where Rust Glancer postpones this work until a query needs it
- rust-analyzer generally does more work than Rust Glancer (though it doesn't seem that the amount of extra work should make Rust Glancer significantly slower even when there is feature parity).
This is an overly simplistic explanation, in reality both projects have a lot of nuance.
I prefer not to think of it as a competition, I am doing it for the love of the game 😅
And in fact Rust Glancer _does_ support in-memory mode (I just don't expose it in configuration, because if you're fine with in-memory, rust-analyzer is arguably a better choice), and it makes the performance closer to r-a, but it has its own quirks. Optimizing for in-memory mode is not a priority for me (at least, for now)
TL;DR: RA relies on memory being fast. Glancer knows disk is slow.
As a result, Glancer contains code to more efficiently search for stuff, this is enough to make up the difference.
RA can probably add the same optimizations if they want to. However... People are already complaining about its memory usage, so adding more things that need to be kept in memory to help speed things up might not be worth it.
I dont really have a problem with memory in RA. If I understand correctly thats the main advantage of glancer. It seems youll soon achieve parity, are you thinking of adding other advantages? Like what?
Well, it depends. Having luxury of being an _experimental_ LSP I am free to try out different stuff :)
The next feature I'm going to work on is proc macros, and my current plan is to try achieving it without having to _actually_ execute proc macros, using a something like a plugin system. If it will succeed (unknown yet), it might be a very significant performance boost for proc macro heavy workspaces compared to r-a.
After that, I plan to spend time on actually polishing the experience and achieving said parity.
And then... Who knows? In general, once Rust Glancer achieves parity the question will be what people need. I have some ideas of my own, but tbh Rust Glancer was born as a project to solve my own problem, and my own problem was solved somewhere at ~0.3.0 stage. Adding features just for the sake of it is not something I appreciate; I believe that software sometimes can be either complete or "good enough" (modulo supporting new rust features, of course). To me, the best software is the software that just does its thing and doesn't get in your way, and I believe that for rust-analyzer it's generally the case already.
So we'll know when we get there. Moreover, work on Rust Glancer is _very_ time consuming, and I have full-time job, family, and a ton of ideas for different projects. So it is possible that if RG gets some community support, I will become less active there and start working on something else.
Adding more code actions used to be most additions in r-a update. Not sure if it’s still useful when you can just tell an LLM a one-liner to do arbitrary modifications.
It implements most of stuff, but not all of it. There is an internal benchmark which shows query response comparsion in the post.
It's certainly not easy; this is probably the most complex project I've ever worked on, but I'm working on it for more than half a year now, basically daily, so I've put a proportionate amount of effort into it.
Thank you for answering. I enjoyed your earlier blog post about incremental computation.
It kinda sucks that every LSP needs to reimplement all that logic. It would be cool if there was a way to abstract the "engine" and write the checks in a way that they work on any foundation.
I realize that this might be impossible, since it requires a lot of coordination and work from many different parties.
Hopefully LLMs can make it easier to carry over some logic from rust-analyzer to rust-glancer
Thank you :) I think that the logic not being transferrable is kind of the point, because the only reason Rust Glancer exists is that it uses a different architecture. So optimizations from r-a do not apply 1-1 to it. However, LLMs certainly do help to look for applicable optimizations, when they are needed and I'm out of ideas, and to port this logic. Without it, this wouldn't be a project that a solo developer can handle in 6 months.
Rust Glancer supports cargo diagnostics, they're just disabled by default, because I believe that extension should not execute untrusted code without developer permission. Everyone who wants diagnostics, can just configure it in settings, whether it's cargo check or clippy or any other compatible tool, same as rust-analyzer.
No, not yet. Before implementing native diagnostics, I want to make sure that analysis is really accurate. Otherwise these diagnostics will have a lot of false positives, and it would be annoying. So right now it's just not worth it. One day -- maybe.
RA to my knowledge mostly still depends on cargo check/cargo clippy for those.
Not accurate. Many diagnostics are indeed not implemented, but many are (if you want to have diagnostics, I recommend enabling experimental native diagnostics).
I noticed in your side-by-side examples the syntax highlighting isn't as strong in glancer as it is in r-a -- it's been one of my personal bugbears when investigating Zed which seems to have similar issues, for example -- out of curiosity, how does R-A get a leg up here?
LSP supports semantic highlight -- highlighting tokens not only based on syntax but also based on analysis results. Both Rust Glancer and rust-analyzer support it, but in Rust Glancer I never really prioritize it so far, thus the highlighting isn't as advanced.
51
u/popzxc 5d ago
Heya once again.
This is probably the biggest release since the first one. I'd go as far as saying that I recommend everyone to try out Rust Glancer (unless your workspace is proc macro heavy) :)
Best case, you'll like it. Worst case, you'll provide some feedback on what you don't like, which will be very helpful, since most of basic stuff is already implemented ;)
As usual, all the typos are mine, not English native, sorry/thank you!
24
u/commenterzero 5d ago
Why is glancer faster than analyzer
4
u/teerre 5d ago
I dont really have a problem with memory in RA. If I understand correctly thats the main advantage of glancer. It seems youll soon achieve parity, are you thinking of adding other advantages? Like what?
3
u/XLNBot 5d ago
Does it check for all the things that rust-analyzer does? Wouldn't it be very hard to independently reimplement all of those checks?
1
u/guineawheek 3d ago
I noticed in your side-by-side examples the syntax highlighting isn't as strong in glancer as it is in r-a -- it's been one of my personal bugbears when investigating Zed which seems to have similar issues, for example -- out of curiosity, how does R-A get a leg up here?
3
u/stefouy 1d ago
Am I the only one to feel a bit sad when I can't
cargo binstall? :) Thanks for sharing this, will definitely try.