rust-analyzer Blog
rust-analyzer.github.io · Company blog · on HN since 2019
The rust-analyzer team writes about the Rust language server, covering its architecture, parsing, macros, and project plans.
What HN saysHN commenters recommend rust-analyzer as an excellent, open-source IDE experience for Rust and cite the blog page listing companies that funded its development.
50HN people shared it
31linked it in comments
38stories submitted
1.2Kstory points
3 months agolast shared
2019people per year2026
Most-shared posts
- 1Manual12 people · first shared 2020
- 2Homepage9 people · first shared 2019
- 3Three Architectures for a Responsive IDE5 people · 7 points · first shared 2020 · discussion on HN
- 4Three Architectures for a Responsive IDE4 people · 47 points · first shared 2020 · 1 comments on HN
- 5Rust Analyzer: Next few years3 people · 162 points · first shared 2020 · 55 comments on HN
- 6Challenging LR Parsing3 people · 121 points · first shared 2020 · 42 comments on HN
- 7IDEs and Macros3 people · 12 points · first shared 2021 · discussion on HN
- 8How to Make a[n IDE] Lightbulb?3 people · 3 points · first shared 2020 · discussion on HN
- 9Rust-Analyzer in 20213 people · 3 points · first shared 2021 · discussion on HN
- 10Rust-analyzer – an IDE backend for Rust2 people · 619 points · first shared 2020 · 112 comments on HN
- 11Ungrammar2 people · 152 points · first shared 2020 · 14 comments on HN
- 12The Heart of a Language Server2 people · 88 points · first shared 2023 · 17 comments on HN
- 13Measuring Memory Usage in Rust2 people · 6 points · first shared 2020 · discussion on HN
- 14Challenging LR Parsing2 people · 5 points · first shared 2020 · discussion on HN
- 15Durable Incrementality2 people · 2 points · first shared 2023 · discussion on HN
What HN people wrote when they linked it
iudqnolq · 2023-04-29
Has Microsoft actually dedicated a lot of work to Rust in vsc? They haven't contributed significantly to the rust-analyzer project, which owns the vsc extension.
> The following companies contributed significantly towards rust-analyzer development: Ferrous Systems Mozilla Embark Studios freiheit.com
https://rust-analyzer.github.io/
brundolf · 2021-07-19
rust-analyzer [1] goes through the LSP and it's fantastic. It provides an incredibly rich experience nearly on-par with that of TypeScript in VSCode, but for Rust. And it's both third-party and open-source.
[1] https://rust-analyzer.github.io/
hobofan · 2020-09-18
> toolchain (auto-completion) is weak
Based on your link, it looks like you are specifically referring to RLS. With the newer contender rust-analyzer[0] auto-completion is very good. In combination with TabNine[1] (for Rust the Pro version is free), auto-completion is pretty amazing by now.
[0]: https://rust-analyzer.github.io/
[1]: https://www.tabnine.com/
muizelaar · 2020-05-21
From https://rust-analyzer.github.io/:
"The following companies contributed significantly towards rust-analyzer development: Ferrous Systems, Mozilla, Embark Studios, freiheit.com".
steveklabnik · 2019-12-19
Great!
For anyone else who hasn't: https://rust-analyzer.github.io/ and https://ferrous-systems.com/blog/rust-analyzer-2019/
xpe · 2023-02-14
Good questions. Clear, organized. Please share what you find as you compare existing languages.
Regarding (F) -- this is partly about (a) the language's interop story and partly about (b) building a community of people that gets along, get things done, and strikes a balance being independent enough to generate something useful and different while being open to compromising for industry adoption (which often means "slowing down" and stabilizing when the time is right).
(a) There are a lot of great ways to ease editor integration. One is to build/maintain language server / analyzer. See https://rust-analyzer.github.io. Another is to share and maintain a formal grammar.
(b) I've been very pleased with my interactions in the Rust community in this regard. There are certainly many ingredients to mix in ways that make sense for a particular community. In my view, the key aspects are (i) be clear about what your language community stands for; (ii) strike a balance between fairness, transparency, and privacy in how you get there; (iii) build in accountability and feedback loops
matklad · 2024-09-06
And
https://rust-analyzer.github.io/blog/2020/07/20/three-architectures-fo…
Is a must-read if you are to build your own LSP server!
c0balt · 2022-12-15
Most editors (or plugins for them) that support a LSP, like rust analyzer[0], can do it. This includes afaik (neo)vim (via coc.nvim), vscode (via rust-analyzer extension), emacs and Clion.
[0]: https://rust-analyzer.github.io/
TheCycoONE · 2022-11-23
I think I followed. One aspect of a programming language is how easy it is to build a useful IDE for with code prediction, navigation, refactoring, etc. Java is relatively easy, Lua is very hard. Rust is somewhere in the middle, with macros being a complicating factor. https://rust-analyzer.github.io/blog/2021/11/21/ides-and-macros.html discusses the problems specific to rust much better than I could.
azdavis · 2022-08-18
Just to make the MVP simpler.
I note in the caveats that the current approach is to recompute everything whenever even one file is changed. But that’s probably not sustainable, as I admit myself in https://azdavis.net/posts/pl-idea-tooling/ :
> As an example, it would be unsustainable if, every time we changed a single function’s body, the language server had to re-typecheck the entire codebase. This might work for an initial proof-of-concept on a small codebase, but for large ones, the responsiveness of the language server would drop precipitously.
If I get around to addressing this, I’d probably use salsa and/or follow along this post: https://rust-analyzer.github.io//blog/2020/07/20/three-architectures-f…
arm · 2020-05-07
For me, I’ve recently started using Emacs solely due to wanting to try out rust-analyzer¹ (not touching Visual Studio Code since it uses Electron), and I’m really enjoying how insanely customizable Emacs is! The ecosystem around Emacs looks great too, with quite a few packages I´m interested in trying (like Magit²).
――――――
¹ — https://rust-analyzer.github.io/blog/2020/04/20/first-release.html
² — https://magit.vc/
chriskrycho · 2020-09-26
I’m curious, given salsa’s[1] so-far quite-effective use of the incremental computation (Adapton/Incremental/Bonsai), if you could elaborate on some of the pitfalls there for UI specifically. The primary salsa use case so far (in rust-analyzer[2]) is obviously fairly different from the pure UI use case, as it’s allowing other things to do the work on the UI and is using it purely for the incremental computation of compilation results, which are a very different set of constraints from UI painting. But at that point, my own knowledge runs out: thus the question.
[1]: https://salsa-rs.github.io/salsa/
[2]: https://rust-analyzer.github.io/
This is particularly of interest to me because I work day in and day out with what is to my knowledge the only application of the incremental computation approach to browser UI,[3] and colleagues and I have talked about what it would take to reimplement in Rust—what the tradeoffs would be, where the problems would emerge, etc. I suspect part of the issue is that the constraints of using the DOM informs a lot of the design considerations in the space, whereas implementing from scratch gives very different tradeoffs?
[3]: https://v5.chriskrycho.com/journal/autotracking-elegant-dx-via-cutting…
Nullabillity · 2020-07-15
On paper, but it sure doesn't feel like it when trying to use it.
It's nearly impossible to find out which of the umpteen repositories contains the source for the class you're trying to understand, and MSDN won't be of much help. Much of the standard library also has a bunch of decoy source files that only contain signatures and/or mocks, so it's a pain to find the real version.
OmniSharp has a "go-to-source" option, but you only get the real source if it's in the same solution. Otherwise you only get signatures. Try giving Metals[0] or Rust-Analyzer[1] a shot, this stuff is night-and-day.
The official debugger (vsdbg) only works in VS and VSCode (and explicitly not in FOSS builds of VSCode). There is netcoredbg[2], but I still haven't figured out how to convince Emacs to use it. This wouldn't be as much of a problem if the culture wasn't so hostile to printf debugging (for example, ~nobody bothers to implement helpful ToStrings).
There is a heavy cultural bias towards MS libraries, regardless of their merits (ASP.Net Core, DI hell, EFCore, etc). See [3] for an.. interesting example.
OmniSharp has a habit of giving up randomly, giving useless error messages, and most GH issues consist of people repeating "+1", until there is a one-liner about how an update fixed it. Root cause analysis, what's that?
[0]: https://scalameta.org/metals/
[1]: https://rust-analyzer.github.io/
[2]: https://github.com/Samsung/netcoredbg
[3]:…
auraham · 2025-10-17
I tried helix a few months ago. Before that, I gave it a try several times. The editor is fine, but I always go back to vim and vscode for these reasons:
- In vim, I can use vim-fugitive [1] to easily run git add and git commit. Not sure if helix has that level of integration with Git (I like the gutter, though). I know that we can use tools like lazygit within Helix, but I think :Gw and :Git commit are more ergonomic.
- I prefer vscode to code in Rust because of rust-analyzer [2]. That plugin gives me type type annotations along each variable. Helix can also provide some hints, but not that many as rust-analyzer.
[1] https://github.com/tpope/vim-fugitive
[2] https://rust-analyzer.github.io/book/vs_code.html
pabs3 · 2025-03-13
You might want to reconsider use of rust-analyzer, it isn't safe to use on code you haven't written yourself.
https://rust-analyzer.github.io/book/security.html
czei002 · 2024-09-07
I would blame Rust though. For example, Rust has macros which are way too powerful and make it very hard to write a LSP (https://rust-analyzer.github.io/blog/2021/11/21/ides-and-macros.html)
Very interesting is how Roslyn/Typescript does it: https://www.youtube.com/watch?v=qnyOHY7AiZk
davidkellis · 2024-02-21
These are not new, but my takeaways from https://tratt.net/laurie/blog/2020/which_parsing_approach.html and https://rust-analyzer.github.io/blog/2020/09/16/challeging-LR-parsing.… are to embrace various forms of LR parsing. https://github.com/igordejanovic/parglare is a very capable GLR parser, and I've been keeping a close eye on it for use in my projects.
GrayShade · 2023-03-19
> the work of a language server didn't need to fully compile the source code to be effective
And you can get that by toggling three settings in your LSP client. They're even documented in the user manual [0].
They are enabled by default because users won't be happy if their proc macros don't work. They'd be even less happy with the "ctags for Rust" approach you're suggesting.
[0] https://rust-analyzer.github.io/manual.html#security
bbkane · 2022-10-23
tnzk · 2022-05-22
Agree on 2 if you meant something like inlay hists in rust-analyzer.
https://rust-analyzer.github.io/manual.html#inlay-hints
cliftonk · 2022-01-29
what hes looking for can trivially be seen using `cargo docs` or `rust-analyzer` https://rust-analyzer.github.io/manual.html
rust-analyzer supports vim/emacs as well. in vim i can put my cursor over a symbol and get all the information id get from an ide via a quick shortcut. a feature-rich vimrc for rust can be seen here: https://github.com/jonhoo/configs/blob/master/editor/.config/nvim/init…
unrealhoang · 2021-11-24
Structural refactoring as in extract function/variable? You can find that in Rust Analyzer https://rust-analyzer.github.io/manual.html#assists-code-actions
Measter · 2021-11-24
Rust Analyzer can do structural search and replace [0], though I've never used it nor IntelliJ's so I can't compare how capable both features are.
[0] https://rust-analyzer.github.io/manual.html#structural-search-and-repl…
greenshackle2 · 2021-05-14
By default rust-analyzer also executes Rust build scripts (build.rs) just by opening the project in an IDE, so as far as Rust goes the comparison is apt.
rust-analyzer.cargo.runBuildScripts (default: true)
Run build scripts (build.rs) for more precise code analysis.
https://rust-analyzer.github.io/manual.html
mzl · 2020-10-27
Another commenter recommended rust-analyzer as a source of inspiration. the main author, matklad, has written some very interesting blog posts describing ideas used that might be of interest to you:
* https://rust-analyzer.github.io/blog/2020/09/16/challeging-LR-parsing.…
* https://rust-analyzer.github.io/blog/2020/10/24/introducing-ungrammar.…
* https://rust-analyzer.github.io/blog/2020/09/28/how-to-make-a-light-bu…
* https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing…
* https://matklad.github.io/2020/04/15/from-pratt-to-dijkstra.html
baby · 2020-09-26
For example, I'm trying to setup rust-analyzer with emacs right now, and the instructions here makes 0 sense at all: https://rust-analyzer.github.io/manual.html#emacs
I'm completely stuck at step 2 and 3, how can anyone parse this without being an emacs pro is beyond me
gameswithgo · 2020-05-21
Yes, it uses the language server protocol:
https://microsoft.github.io/language-server-protocol/
The rust-analyzer docs show how to wire it up to VIM a few different ways:
https://rust-analyzer.github.io/manual.html#installation
pohl · 2020-05-21
They’re not alternatives to each other. It depends on how nice you want your experience editing Rust within Sublime to be. You could just try it out:
https://rust-analyzer.github.io/manual.html#sublime-text-3
thomasfoster96 · 2020-05-21
You can use rust-analyzer from within Sublime Text: https://rust-analyzer.github.io/manual.html#sublime-text-3
If you’re using Sublime Text 3, it’s essentially an alternative to RustEnhanced[0].
[0] https://github.com/rust-lang/rust-enhanced
chubot · 2023-08-15
Yes, the language there is Zephyr ASDL [1]. I actually changed this:
Dict(expr* keys, expr* values)
to
Dict(List[expr] keys, List[expr] values)
in our fork for https://oilshell.org/ , and it made a lot more sense to contributors.
It's funny how "sticky" syntax is -- two contributors ALSO read * as "pointer" ! So I changed it to be consistent with MyPy syntax earlier this year, and now I think I should have done that a long time ago.
(It would also make sense to change it to keys: List[expr], as that's the Python 3 syntax for types)
---
The funny thing is that while the web page says "Abstract Grammar", I would not call Zephyr ASDL a grammar.
Python has a separate Grammar/Grammar file, that is distinct from this file Python/Python.asdl.
A grammar describes a set of strings, and that's not what ASDL does.
It describes the data structure that the valid strings get transformed to after parsing, and there is not a 1:1 correspondence (e.g. due to the difference between a CST and AST, and other post-parsing validation).
I mentioned that here: https://www.oilshell.org/blog/2016/12/11.html#it-describes-a-data-stru…
(Pretty sure "ungrammar" from rust-analyzer is nodding at this -- https://rust-analyzer.github.io//blog/2020/10/24/introducing-ungrammar… -- it's "ASDL for concrete syntax trees", i.e. it's not a grammar because it doesn't describe strings; it describes trees)
[1] https://www.oilshell.org/blog/tags.html?tag=ASDL#ASDL