GitHub - emacs-lsp/lsp-rust
source link: https://github.com/emacs-lsp/lsp-rust
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
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.
Setup
First, install the RLS.
Then you should just load lsp-rust
after 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 setq
line tells lsp-rust
how to launch the RLS. If you would rather use the
RLS_ROOT
variable to locate the RLS, then set lsp-rust-rls-command
to nil
.
Now, you can activate lsp-mode
in a Rust buffer, and you should have all the
benefits of the RLS as handled by lsp-mode
.
If you want on-the-fly syntax checking, first make sure that lsp-flycheck
is
loaded (see lsp-mode
installation), then simply
turn on flycheck-mode
.
If you want to automatically launch lsp-mode
and 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)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK