about summary refs log tree commit diff
path: root/init
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-05-08T20·32+0200
committerVincent Ambo <tazjin@gmail.com>2018-05-08T20·32+0200
commitced93e2606bbe610650e5313ab5c7cd0f0726887 (patch)
tree18e69764dc7d13f552d05ce84d0a6bfde0d530cf /init
parent6061d1bbb29f93e6aeeb0e8b530571cf08e59af2 (diff)
feat(rust): Move to RLS/LSP setup
Lets see how long this lasts ...
Diffstat (limited to 'init')
-rw-r--r--init/rust-setup.el19
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)