Rust support for lsp-mode using the Rust Language Server.
Warning: RLS is currently very unstable, which can make Emacs hang indefinitely. Using this in production isn't recommended.
First, install the RLS.
Then you should just load
lsp-mode by adding the following to
your init file:
(with-eval-after-load 'lsp-mode (setq lsp-rust-rls-command '("rustup" "run" "nightly" "rls")) (require 'lsp-rust))
If you installed the RLS via
rustup (the recommended way), then the
lsp-rust how to launch the RLS. If you would rather use the
RLS_ROOT variable to locate the RLS, then set
Now, you can activate
lsp-mode in a Rust buffer, and you should have all the
benefits of the RLS as handled by
If you want on-the-fly syntax checking, first make sure that
loaded (see lsp-mode
installation), then simply
If you want to automatically launch
flycheck-mode whenever you
open a rust buffer, you can add the following to your init file:
(add-hook 'rust-mode-hook #'lsp-rust-enable) (add-hook 'rust-mode-hook #'flycheck-mode)