2017-11-12 22:41:54 +01:00
|
|
|
(require 'company)
|
2018-05-08 22:32:09 +02:00
|
|
|
(require 'flycheck)
|
|
|
|
(require 'lsp-mode)
|
|
|
|
(require 'lsp-rust)
|
|
|
|
(require 'lsp-ui)
|
2017-11-06 19:35:19 +01:00
|
|
|
(require 'rust-mode)
|
|
|
|
|
2018-05-08 22:32:09 +02:00
|
|
|
;; 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)
|
|
|
|
|
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
|
|
|
|
(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)
|