I have been working on a little rust project lately (more on that some time later). For this I have been using Emacs with
cargo-mode (see my config). This setup already works quite nicely with all the nice IDE-like features you would expect. But, I also really like the idea of Microsoft's language server protocol , where the various editors out there can use a single implementation of a common "language" server that does the indexing, auto-completion, docs, etc.pp. for a given programming language. The common language server for rust (rls) can be installed via rustup (assuming one is already using rustup and rust nightly, if not go to the rls README.md and follow the instructions there):
rustup component add rls --toolchain nightly rustup component add rust-analysis --toolchain nightly rustup component add rust-src --toolchain nightly
As for Emacs, there is the common lsp-mode and the rust specific lsp-rust. Btw, RMS also seems to like lsp; who knows maybe we get out of the box support for it someday. For now the installation via use-package is also fairly trivial:
(use-package rust-mode :mode "\\.rs\\'" :init (setq rust-format-on-save t)) (use-package lsp-mode :init (add-hook 'prog-mode-hook 'lsp-mode) :config (use-package lsp-flycheck :ensure f ; comes with lsp-mode :after flycheck)) (use-package lsp-rust :after lsp-mode)
This already provides all the goodies: auto-completion, eldoc, goto definition, symbol references, flycheck.
I have used it for the last couple of days and it mostly works. On the initial opening of a project it will hog the CPU and spin up the fans but that doesn't last too long. Sometimes it completely hangs Emacs. Nothing that
killall rls followed by a
M-x revert-buffer can't fix. (It seems to correlate with my having written some bad rust code full of errors, so ultimately I am to be blamed I guess). Long story short, quite usable already with a few glitches, but very promising!