Rust Analyzer in 2018 and 2019
ferrous-systems.com
ferrous-systems.com
[1]: https://github.com/matklad
Mind you, in the IDE above reflection builtin the language allows for the incredible amount of power. In Rust's case, the only way I can I see it replicated is at a layer before compile time, hence my interest in your analyzer.
BTW Sourcegraph is interested in funding this effort and building better Rust support for code browsing and search into our product using https://docs.sourcegraph.com/extensions. I just reached out to the author.
(Aside: are you from n-gate.com, as your username suggests?)
For instance, if I have a file that compiles and I start typing in the space between two function bodies, I'm probably implementing a new function. In fact that probability is so high that you should just assume that to be the case, even if the code I've written so far doesn't have balanced nesting yet. All decisions and advice should be based on the speculation that the code will eventually represent a new set of blocks, not a reorganization of the remaining ones.
You can't make the same assumption about if statements inside of a function, or about incomplete multiline comments, but you can assume that anywhere from zero to all of the sibling blocks are about to have their scope changed (but not ancestors).
In short, the gap between how I'd describe a commit and how the diff tool represents it also prevents live code analysis from being able to work as well as it might.
Most programming languages aren't designed for parsing backwards, though!
fn foo() { }
fn
fn bar() { }
Syntax tree (whitespace nodes elided for clarity): SOURCE_FILE@[0; 31)
FN_DEF@[0; 12)
FN_KW@[0; 2)
NAME@[3; 6)
IDENT@[3; 6) "foo"
...
FN_DEF@[14; 16)
FN_KW@[14; 16)
err: `expected a name`
FN_DEF@[18; 30)
FN_KW@[18; 20)
NAME@[21; 24)
IDENT@[21; 24) "bar"
...
The problem is, a lot of tools are build with the assumption that the code is correct&complete, and don't try to tackle this problem at all.Sounds like we lost some of that along the way.
That said, I don't think I'd be after a perfect Vim copy. I think I would like an editor that uses the same approach, doesn't have to be exactly the same keybindings.
> Analyzer maintains a "database" of input facts (source code + information about project structure) and derived facts (syntax trees, name resolution information, types). The client then can change input facts, and query derived facts at the current state of the world.
seems that it could also be adopted by a language sever for Rust.
One outcome of all this might be that RLS internally gets replaced by something like rust-analyzer, which is something that the maintainer of RLS has mused in a recent blog post as one of many possible options for the future of RLS:
https://www.ncameron.org/blog/more-on-rls-version-numbering/
Citation needed.
Hotspot long term roadmap is to be rewritten in Java for example, aka Project Metropolis. And not all JVMs are implemented in C or C++.
Side: Has emacs been losing traction slowly? It's a third of vim!
Also many people did not know TRAMP is a thing so yeah...
Nowadays XEmacs seems to have died, I have plenty of IDEs to choose from for my favourite languages, even on GNU/Linux and Emacs seems to still lack some of the nice features of XEmacs.
As for VIM, I learned VI on Xenix, but never could bother to actually use it more than for profile files, or as the go-to editor over telnet/ssh sessions when nothing else was installed by default.
I assume many on the IDE camp might share a similar experience.