Why not replace intelij-rust with rust-analyzer?

So, rust-analyzer is already technology wise superior to intellij-rust, not having some annoying bugs and so on. But there is no plugin for intelij ide-s which would support rust-analyzer. Developing two lsp clients seems unreasonable to me, so why is intellij-rust still a thing?

Mainly because it's AFAIK developed by JetBrains themselves and not by Rust community, and for them it's better to have their own implementation, which can be maintained without relying on anything upstream.

3 Likes

Why don't rust-analyzer developers make a intellij plugin?

Pinging @matklad for exact answer, but I guess that, given the existence of owner-provided plugin, this is simply low-priority.

1 Like

First of all, I wouldn't say that RA is superior compared to IntelliJ Rust. There are some things we are doing better, some things they are ahead of us. All in all there's actually a bit of healthy competition.

Second, IntelliJ has its own analysis infrastructure. To build a good IntelliJ plugin, you have to build the code analysis on top of that (which is what the IntelliJ Rust guys are doing), and in turn it provides you with a lot of things to help, which is why IntelliJ Rust has been able to do such a good job so far. I don't think IntelliJ currently has good enough support for LSP that you could build an equivalent experience with that.

Third, we (the RA team) are focused on building rust-analyzer, not editor plugins. The only editor plugin that's built by the RA team is the VSCode one, because it serves as the official example integration -- it would be hard for us to build new features without integrating/testing them in some editor, but we can't maintain plugins for all editors. Also, I don't think we have the expertise to actually build an IntelliJ plugin (except for matklad, but he's currently not that active).

16 Likes

What Florian says, plus a couple of more points:

  • LSP is still a very bare bones thing, IJ does a lot of things which can not be expressed in LSP. Like, LSP doesn’t really support general refactors where you want some input from the user. Though, ra itself is well positioned to support all those extras by bypassing LSP entirely, that’s some more work.

    In contrast, with IntelliJ Rust JetBrains can do just whatever is needed for any particular feature.

  • JetBrains do use rust-analyzer in fleet.

12 Likes

Didn't you mean "lsp servers"? An lsp client is the integration of the language server into a specific editor, and you need at least as many of those as there are editors, because you need integration with editor's APIs and proper UI. This means that even if intellij-rust switched to a RA backend, the plugin would still need to exist, and it would contain a surprising large fraction of the current plugin's code.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.