2020-12-01 18:01:03 +01:00
|
|
|
;;; ../code/depot/users/glittershark/emacs.d/rust.el -*- lexical-binding: t; -*-
|
|
|
|
|
2020-12-14 18:46:15 +01:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.rs$" . rust-mode))
|
|
|
|
|
2020-12-01 18:01:03 +01:00
|
|
|
(defun grfn/rust-setup ()
|
2020-12-14 18:46:15 +01:00
|
|
|
(interactive)
|
2021-01-13 16:09:03 +01:00
|
|
|
|
|
|
|
(push '(?> . ("<" . ">")) evil-surround-pairs-alist)
|
|
|
|
|
2020-12-01 18:01:03 +01:00
|
|
|
(setq lsp-rust-server 'rust-analyzer)
|
2020-12-14 18:46:15 +01:00
|
|
|
(setq-local whitespace-line-column 100
|
|
|
|
fill-column 100)
|
|
|
|
(setq rust-format-show-buffer nil)
|
2021-01-13 16:09:03 +01:00
|
|
|
(setq lsp-rust-analyzer-import-merge-behaviour "last"
|
|
|
|
lsp-rust-analyzer-cargo-watch-command "clippy"
|
|
|
|
lsp-ui-doc-enable t)
|
2020-12-01 18:01:03 +01:00
|
|
|
(rust-enable-format-on-save)
|
|
|
|
(lsp))
|
|
|
|
|
|
|
|
(add-hook 'rust-mode-hook #'grfn/rust-setup)
|
2020-12-14 18:46:15 +01:00
|
|
|
|
|
|
|
(map!
|
|
|
|
(:map rust-mode-map
|
|
|
|
:n "g RET" #'cargo-process-current-file-tests
|
|
|
|
:n "g R" #'lsp-find-references
|
|
|
|
(:localleader
|
|
|
|
"m" #'lsp-rust-analyzer-expand-macro)))
|
2021-01-13 16:09:03 +01:00
|
|
|
|
|
|
|
(comment
|
|
|
|
(flycheck-get-next-checkers 'lsp)
|
|
|
|
(flycheck-add-next-checker)
|
|
|
|
(flycheck-get-next-checkers 'lsp)
|
|
|
|
)
|
|
|
|
|
|
|
|
(set-company-backend! 'rust-mode
|
|
|
|
'(:separate company-capf company-yasnippet))
|