From 2590dda349d3e7554ff16e3cac521e5683de3c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hauspie?= <michael.hauspie@univ-lille.fr> Date: Tue, 29 Dec 2020 09:58:01 +0100 Subject: [PATCH] Fix rust lsp --- configuration.org | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/configuration.org b/configuration.org index 9a98ceb..8aaa981 100644 --- a/configuration.org +++ b/configuration.org @@ -775,18 +775,28 @@ Some of my configuration entries where borrowed from other people, see #+begin_src emacs-lisp (use-package lsp-mode :hook ( - c++-mode - python-mode - rust-mode + (c++-mode . lsp) + (python-mode . lsp) + (rust-mode . lsp) + (lsp-mode . lsp-enable-which-key-integration) ) :config - (lsp-headerline-breadcrumb-mode t)) + (lsp-headerline-breadcrumb-mode t) + :commands lsp + ) #+end_src For displaying more information directly in the buffer, I use =lsp-ui= #+begin_src emacs-lisp -(use-package lsp-ui) +(use-package lsp-ui + :commands lsp-ui-mode) + #+end_src + + LSP keybinds + + #+begin_src emacs-lisp +(setq lsp-keymap-prefix "s-l") #+end_src *** Integration with treemacs @@ -820,29 +830,19 @@ Some of my configuration entries where borrowed from other people, see *** Rust - Install =rust-mode= and set the rust language server to rls. - ([[https://rust-analyzer.github.io/][rust-analyzer]] still crashes too much) It also sets =rustfmt= to be - called to format buffer when saving. + Install =rust-mode= and set the rust language server to [[https://rust-analyzer.github.io/][rust-analyzer]] #+begin_src emacs-lisp (use-package rust-mode :custom - (lsp-rust-server 'rls) + (lsp-rust-server 'rust-analyzer) ; (rust-format-on-save t) ) #+end_src - For this to work, you need to install =rust-analyzer= and =rustmft=. - - #+begin_src bash -echo "Installing rust-analyzer" -git clone https://github.com/rust-analyzer/rust-analyzer.git && cd rust-analyzer -cargo xtask install --server || echo "failed" -echo "Installing rustfmt" -cargo install rustfmt || echo "failed" - #+end_src - + For this to work, you need to install =rust-analyzer= in + =~/.cargo/bin=. Adds cargo installed binaries to exec path -- GitLab