mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 19:40:24 +10:00
Updating Doom Emacs.
This commit is contained in:
@@ -10,26 +10,27 @@
|
||||
(use-package! rustic
|
||||
:mode ("\\.rs$" . rustic-mode)
|
||||
:commands rustic-run-cargo-command rustic-cargo-outdated
|
||||
:init
|
||||
(after! org-src
|
||||
(add-to-list 'org-src-lang-modes '("rust" . rustic)))
|
||||
:config
|
||||
(set-docsets! 'rustic-mode "Rust")
|
||||
(set-popup-rule! "^\\*rustic-compilation" :vslot -1)
|
||||
|
||||
(setq rustic-indent-method-chain t
|
||||
rustic-flycheck-setup-mode-line-p nil
|
||||
;; use :editor format instead
|
||||
rustic-format-trigger nil
|
||||
;; REVIEW `rust-ordinary-lt-gt-p' is terribly expensive in large rust
|
||||
;; buffers, so we disable it, but only for evil users, because it
|
||||
;; affects `forward-sexp' and its ilk. See
|
||||
;; https://github.com/rust-lang/rust-mode/issues/288.
|
||||
rustic-match-angle-brackets (not (featurep! :editor evil))
|
||||
;; We use the superior default client provided by `lsp-mode', not the
|
||||
;; one rustic-mode sets up for us.
|
||||
rustic-lsp-client nil)
|
||||
rustic-format-trigger nil)
|
||||
|
||||
(add-hook 'rustic-mode-hook #'rainbow-delimiters-mode)
|
||||
(if (featurep! +lsp)
|
||||
(add-hook 'rustic-mode-local-vars-hook #'lsp!)
|
||||
(setq rustic-lsp-server nil)
|
||||
(after! rustic-flycheck
|
||||
(add-to-list 'flycheck-checkers 'rustic-clippy)))
|
||||
|
||||
(when (featurep! +lsp)
|
||||
(add-hook 'rustic-mode-local-vars-hook #'lsp!))
|
||||
(if (featurep! :tools lsp +eglot)
|
||||
(setq rustic-lsp-client 'eglot)
|
||||
(setq rustic-lsp-client 'lsp-mode)))
|
||||
|
||||
(map! :map rustic-mode-map
|
||||
:localleader
|
||||
@@ -46,16 +47,32 @@
|
||||
:desc "cargo run" "r" #'rustic-cargo-run)
|
||||
(:prefix ("t" . "cargo test")
|
||||
:desc "all" "a" #'rustic-cargo-test
|
||||
:desc "current test" "t" #'rustic-cargo-current-test)))
|
||||
:desc "current test" "t" #'rustic-cargo-current-test))
|
||||
|
||||
;; HACK Fixes #2541: RLS doesn't appear to support documentSymbol, but
|
||||
;; lsp-rust thinks it does, and so yields imenu population to the server.
|
||||
;; The result is an empty imenu list. Until RLS supports documentSymbol,
|
||||
;; we disable `lsp-enable-imenu' is rust+RLS buffers.
|
||||
(defadvice! +rust--disable-imenu-for-lsp-mode-a (&rest _)
|
||||
:before #'rustic-lsp-mode-setup
|
||||
(when (eq rustic-lsp-server 'rls)
|
||||
(setq-local lsp-enable-imenu nil)))
|
||||
|
||||
;; If lsp/elgot isn't available, it attempts to install lsp-mode via
|
||||
;; package.el. Doom manages its own dependencies through straight so disable
|
||||
;; this behavior to avoid package-not-initialized errors.
|
||||
(defadvice! +rust--dont-install-packages-a (&rest _)
|
||||
:override #'rustic-install-lsp-client-p
|
||||
(message "No LSP server running")))
|
||||
|
||||
|
||||
(use-package! racer
|
||||
:unless (featurep! +lsp)
|
||||
:hook (rustic-mode . racer-mode)
|
||||
:init
|
||||
;; Fix #2132: `racer' depends on `rust-mode', which tries to modify
|
||||
;; `auto-mode-alist'. We make extra sure that doesn't stick, especially when a
|
||||
;; buffer is reverted, as it is after rustfmt is done wiht it.
|
||||
;; HACK Fix #2132: `racer' depends on `rust-mode', which tries to modify
|
||||
;; `auto-mode-alist'. We make extra sure that doesn't stick, especially
|
||||
;; when a buffer is reverted, as it is after rustfmt is done with it.
|
||||
(after! rust-mode
|
||||
(setq auto-mode-alist (delete '("\\.rs\\'" . rust-mode) auto-mode-alist)))
|
||||
:config
|
||||
|
||||
Reference in New Issue
Block a user