2017-11-12 22:41:54 +01:00
|
|
|
(require 'company)
|
2018-06-03 22:36:43 +02:00
|
|
|
(require 'eglot)
|
2018-05-08 22:32:09 +02:00
|
|
|
(require 'flycheck)
|
2017-11-06 19:35:19 +01:00
|
|
|
(require 'rust-mode)
|
|
|
|
|
2018-05-08 22:32:09 +02:00
|
|
|
;; LSP configuration:
|
2018-06-03 22:36:43 +02:00
|
|
|
(defvar rust-eglot-initialized nil)
|
|
|
|
(add-hook 'rust-mode-hook (lambda ()
|
|
|
|
(unless rust-eglot-initialized
|
|
|
|
(call-interactively #'eglot)
|
|
|
|
(setq rust-eglot-initialized t))))
|
2018-05-08 22:32:09 +02:00
|
|
|
|
2017-11-06 19:35:19 +01:00
|
|
|
;; Enable cargo-related (C-c C-c C-...) commands.
|
|
|
|
(add-hook 'rust-mode-hook #'cargo-minor-mode)
|
|
|
|
|
|
|
|
;; Configure autocompletion for rust
|
2018-06-03 22:36:43 +02:00
|
|
|
(add-hook 'rust-mode-hook #'company-mode)
|
2017-11-06 19:35:19 +01:00
|
|
|
(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)
|
2017-11-06 22:26:47 +01:00
|
|
|
|
|
|
|
(provide 'rust-setup)
|