changeset 501:514374a2a5bc

emacs: migrate rust config to use rls and lsp
author Augie Fackler <raf@durin42.com>
date Sat, 03 Oct 2020 11:30:21 -0400
parents 826e5656d9ff
children 12c7a72a9306
files .elisp/settings/99.rust.el
diffstat 1 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/.elisp/settings/99.rust.el
+++ b/.elisp/settings/99.rust.el
@@ -1,24 +1,28 @@
+(use-package flycheck
+  :hook (prog-mode . flycheck-mode))
+
+(use-package company
+  :hook (prog-mode . company-mode)
+  :config (setq company-tooltip-align-annotations t)
+          (setq company-minimum-prefix-length 1))
+
+(use-package lsp-mode
+  :commands lsp
+  :config (require 'lsp-clients))
+
+(use-package lsp-ui)
+
+(use-package toml-mode)
+
 (use-package rust-mode
-             :config (add-hook 'rust-mode-hook
+  :hook (rust-mode . lsp)
+  :config (add-hook 'rust-mode-hook
           (lambda ()
             (local-set-key (kbd "C-c <tab>") #'rust-format-buffer))))
-(setq rust-format-on-save t)
 
+;; Add keybindings for interacting with Cargo
 (use-package cargo
-             :config (add-hook 'rust-mode-hook 'cargo-minor-mode))
-
-(use-package company
-  :init
-  (use-package racer
-    :init
-    (add-hook 'rust-mode-hook #'racer-mode)
-    (add-hook 'racer-mode-hook #'eldoc-mode)
-    (add-hook 'racer-mode-hook #'company-mode)
-    (setq company-tooltip-align-annotations t)
-    ))
+  :hook (rust-mode . cargo-minor-mode))
 
 (use-package flycheck-rust
-  :init
-  (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
-  (add-hook 'rust-mode-hook 'flycheck-mode)
-  )
+  :config (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))