about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-06-03T20·36+0200
committerVincent Ambo <tazjin@gmail.com>2018-06-03T20·36+0200
commit4b9b7f299985c3d4c8cbc8bcbb612135b6b09da9 (patch)
tree34c78453fc6df37a0a17227e5892f98c10c3994f
parentac527952ce9416a66414ca5e767c5a6ebefa3de1 (diff)
feat(rust): Use eglot instead of LSP-mode
See commit `6939aa9` in Nix configuration for more information.
-rw-r--r--init/rust-setup.el16
1 files changed, 7 insertions, 9 deletions
diff --git a/init/rust-setup.el b/init/rust-setup.el
index 6bffc8ef1f13..fcc39ff4e716 100644
--- a/init/rust-setup.el
+++ b/init/rust-setup.el
@@ -1,22 +1,20 @@
 (require 'company)
+(require 'eglot)
 (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)
+(defvar rust-eglot-initialized nil)
+(add-hook 'rust-mode-hook (lambda ()
+                            (unless rust-eglot-initialized
+                              (call-interactively #'eglot)
+                              (setq rust-eglot-initialized t))))
 
 ;; 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 #'company-mode)
 (define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
 (setq company-tooltip-align-annotations t)