Skip to content
Snippets Groups Projects
Commit 068ddf04 authored by Michael Hauspie's avatar Michael Hauspie
Browse files

Changes for LSP

parent 53001bc3
No related branches found
No related tags found
No related merge requests found
...@@ -779,14 +779,16 @@ Some of my configuration entries where borrowed from other people, see ...@@ -779,14 +779,16 @@ Some of my configuration entries where borrowed from other people, see
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package lsp-mode (use-package lsp-mode
:hook ( :hook (
c++-mode (c++-mode . lsp)
python-mode (python-mode . lsp)
rust-mode (rust-mode . lsp)
(lsp-mode . lsp-enable-which-key-integration)
) )
:config :config
(lsp-headerline-breadcrumb-mode t)) (lsp-headerline-breadcrumb-mode t))
#+end_src #+end_src
For displaying more information directly in the buffer, I use =lsp-ui= For displaying more information directly in the buffer, I use =lsp-ui=
#+begin_src emacs-lisp #+begin_src emacs-lisp
...@@ -824,14 +826,14 @@ Some of my configuration entries where borrowed from other people, see ...@@ -824,14 +826,14 @@ Some of my configuration entries where borrowed from other people, see
*** Rust *** Rust
Install =rust-mode= and set the rust language server to rls. Install =rust-mode= and set the rust language server to
([[https://rust-analyzer.github.io/][rust-analyzer]] still crashes too much) It also sets =rustfmt= to be =rust-analyzer=. It also sets =rustfmt= to be called to format
called to format buffer when saving. buffer when saving.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package rust-mode (use-package rust-mode
:custom :custom
(lsp-rust-server 'rls) (lsp-rust-server 'rust-analyzer)
; (rust-format-on-save t) ; (rust-format-on-save t)
) )
...@@ -839,14 +841,22 @@ Some of my configuration entries where borrowed from other people, see ...@@ -839,14 +841,22 @@ Some of my configuration entries where borrowed from other people, see
For this to work, you need to install =rust-analyzer= and =rustmft=. For this to work, you need to install =rust-analyzer= and =rustmft=.
#+begin_src bash #+begin_src bash :results output verbatim
echo "Installing rust-analyzer" if [[ "$OSTYPE" =~ ^darwin ]]
git clone https://github.com/rust-analyzer/rust-analyzer.git && cd rust-analyzer then
cargo xtask install --server || echo "failed" echo "Installing for macos"
echo "Installing rustfmt" binary=rust-analyzer-mac
cargo install rustfmt || echo "failed" else
echo "Installing for linux"
binary=rust-analyzer-linux
fi
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/$binary -o ~/.cargo/bin/rust-analyzer
chmod +x ~/.cargo/bin/rust-analyzer
#+end_src #+end_src
#+RESULTS:
: Installing for macos
Adds cargo installed binaries to exec path Adds cargo installed binaries to exec path
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment