lang/rust: add eglot docs & inhibit package.el usage #2195
This commit is contained in:
parent
969b047472
commit
a0425d0df7
2 changed files with 31 additions and 3 deletions
|
@ -13,6 +13,7 @@
|
||||||
- [[#keybinds][Keybinds]]
|
- [[#keybinds][Keybinds]]
|
||||||
- [[#configuration][Configuration]]
|
- [[#configuration][Configuration]]
|
||||||
- [[#enable-rust-analyzer][Enable rust-analyzer]]
|
- [[#enable-rust-analyzer][Enable rust-analyzer]]
|
||||||
|
- [[#enabling-elgot-support-for-rust][Enabling elgot support for Rust]]
|
||||||
- [[#troubleshooting][Troubleshooting]]
|
- [[#troubleshooting][Troubleshooting]]
|
||||||
|
|
||||||
* Description
|
* Description
|
||||||
|
@ -73,11 +74,22 @@ and the ~+lsp~ flag on this module.
|
||||||
|
|
||||||
* TODO Configuration
|
* TODO Configuration
|
||||||
** Enable rust-analyzer
|
** Enable rust-analyzer
|
||||||
You'll need [[https://github.com/rust-analyzer/rust-analyzer][rust-analyzer]] installed on your system, then add the following to
|
You'll need [[https://github.com/rust-analyzer/rust-analyzer][rust-analyzer]] installed on your system, then use the following:
|
||||||
=$DOOMDIR/config.el=:
|
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
|
;; in $DOOMDIR/config.el
|
||||||
(setq lsp-rust-server 'rust-analyzer)
|
(setq lsp-rust-server 'rust-analyzer)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
** Enabling elgot support for Rust
|
||||||
|
Doom doesn't have eglot support (yet), but if you've installed it yourself and
|
||||||
|
want rust to use eglot instead of LSP, use the following:
|
||||||
|
|
||||||
|
#+BEGIN_SRC elisp
|
||||||
|
;; in $DOOMDIR/config.el
|
||||||
|
(after! rustic
|
||||||
|
(setq rustic-lsp-server 'rust-analyzer ; optional
|
||||||
|
rustic-lsp-client 'eglot))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
* TODO Troubleshooting
|
* TODO Troubleshooting
|
||||||
|
|
|
@ -46,7 +46,23 @@
|
||||||
:desc "cargo run" "r" #'rustic-cargo-run)
|
:desc "cargo run" "r" #'rustic-cargo-run)
|
||||||
(:prefix ("t" . "cargo test")
|
(:prefix ("t" . "cargo test")
|
||||||
:desc "all" "a" #'rustic-cargo-test
|
:desc "all" "a" #'rustic-cargo-test
|
||||||
:desc "current test" "t" #'rustic-cargo-current-test)))
|
:desc "current test" "t" #'rustic-cargo-current-test))
|
||||||
|
|
||||||
|
(defadvice! +rust--dont-install-packages-p (orig-fn &rest args)
|
||||||
|
:around #'rustic-setup-lsp
|
||||||
|
(cl-letf (;; `rustic-setup-lsp' uses `package-installed-p' to determine if
|
||||||
|
;; lsp-mode/elgot are available. This breaks because Doom doesn't
|
||||||
|
;; use package.el to begin with (and lazy loads it).
|
||||||
|
((symbol-function #'package-installed-p)
|
||||||
|
(lambda (pkg)
|
||||||
|
(require pkg nil t)))
|
||||||
|
;; If lsp/elgot isn't available, it attempts to install lsp-mode
|
||||||
|
;; via package.el. Doom manages its own dependencies so we disable
|
||||||
|
;; that behavior.
|
||||||
|
((symbol-function #'rustic-install-lsp-client-p)
|
||||||
|
(lambda (&rest _)
|
||||||
|
(message "No RLS server running"))))
|
||||||
|
(apply orig-fn args))))
|
||||||
|
|
||||||
|
|
||||||
(use-package! racer
|
(use-package! racer
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue