diff options
-rw-r--r-- | init/rust-setup.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/init/rust-setup.el b/init/rust-setup.el index df9633da5c66..6bffc8ef1f13 100644 --- a/init/rust-setup.el +++ b/init/rust-setup.el @@ -1,21 +1,26 @@ (require 'company) +(require 'flycheck) +(require 'lsp-mode) +(require 'lsp-rust) +(require 'lsp-ui) (require 'rust-mode) +;; LSP configuration: +(setq lsp-ui-sideline-delay 0.5) +(add-hook 'lsp-mode-hook 'lsp-ui-mode) +(add-hook 'rust-mode-hook #'lsp-rust-enable) +(add-hook 'rust-mode-hook 'flycheck-mode) +(add-hook 'rust-mode-hook 'company-mode) +(push 'company-lsp company-backends) + ;; Enable cargo-related (C-c C-c C-...) commands. (add-hook 'rust-mode-hook #'cargo-minor-mode) ;; Configure autocompletion for rust -(add-hook 'rust-mode-hook #'racer-mode) -(add-hook 'racer-mode-hook #'company-mode) -(add-hook 'racer-mode-hook #'eldoc-mode) (define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common) (setq company-tooltip-align-annotations t) ;; Ensure long compiler errors don't flow out of the screen (very annoying!) (add-hook 'cargo-process-mode-hook #'visual-line-mode) -;; I don't use rustup and I'm not sure which derivation would normally place -;; Rust sources in the nix-store, so I'll continue using my local Rust checkout. -(setq racer-rust-src-path "~/source/rust/src") - (provide 'rust-setup) |