From ced93e2606bbe610650e5313ab5c7cd0f0726887 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 8 May 2018 22:32:09 +0200 Subject: feat(rust): Move to RLS/LSP setup Lets see how long this lasts ... --- init/rust-setup.el | 19 ++++++++++++------- 1 file 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) -- cgit 1.4.1