In the last month i actively worked on something i would like to present in this blog post.
It all started with this reddit conversation:
This got me curious. I thought the LSP specification should be similar in most editors (without knowing a thing) and therefore i investigated my favourite editor: GNOME Builder. In fact i saw immediatly that there are still rough edges regarding the LSP implementation. And still no Rust Analyzer plugin available. This brought me to some lines of code by copying the RLS implementation.
Unsatisfied with the solution i made a complete rewrite as i was not confident enough for python (just occasionally write some lines). I started from scratch implementing a good Rust Analyzer plugin and sharpen the edges of the LSP implementation along the way.
Features Rust Analyzer in GNOME Builder
Speaking of features the first thing you will see if you open a vanilla GNOME Builder rust file in the editor is probably this:
Download offer directly in the IDE
GNOME Builder will download the binary for you if not installed already. Note: Right now there is no version check implemented to re-download in case there is an update available. It’s on my todo list.
Next Rust Analyzer gets started and downloads packages and compiles them in the background. We get a nice progress indicator for these information. This was my first enhancement of the LSP implementation. Implementing the progress/create request. Other LSP server get this now for free which is really nice.
Diagnostic for current file
If you have some problems in your opened rust source file you will immediatly see the triangle on the top indicating some errors.
These diagnostic information are generated from
cargo check called via Rust Analyzer. You can configure RA to use another diagnostic provider (at the moment i only know
cargo clippy but its not restricted to that). Therefore i created the necessary plumbing to set this in GNOME Builder.
Of course the plugin supports autocompletion via LSP. Watch it in action:
In my next post i want to show the remainding features like goto definition, show references, rename etc.