2021-04-11 23:53:27 +02:00
|
|
|
;;; -*- lexical-binding: t; -*-
|
2020-12-01 18:01:03 +01:00
|
|
|
|
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)
|
2021-01-19 16:48:52 +01:00
|
|
|
(push '(?< . ("< " . " >")) evil-surround-pairs-alist)
|
2021-01-13 16:09:03 +01:00
|
|
|
|
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"
|
2021-08-24 15:55:02 +02:00
|
|
|
lsp-rust-analyzer-cargo-watch-args ["--target-dir" "/home/grfn/code/readyset/readyset/target/rust-analyzer"]
|
2021-01-13 16:09:03 +01:00
|
|
|
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
|
2021-08-07 20:06:47 +02:00
|
|
|
:n "g RET" #'lsp-rust-analyzer-run
|
2020-12-14 18:46:15 +01:00
|
|
|
:n "g R" #'lsp-find-references
|
2021-08-02 22:59:46 +02:00
|
|
|
:n "g d" #'lsp-find-definition
|
2022-03-16 14:59:59 +01:00
|
|
|
:n "g Y" #'lsp-goto-type-definition
|
2020-12-14 18:46:15 +01:00
|
|
|
(: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))
|