From 26b8cdefd159ab4e5a3e29d5fd77b42dd91c6d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Alvari=C3=B1o?= Date: Tue, 22 Mar 2022 11:53:51 +0100 Subject: [PATCH] Add LSP Rust configuration --- myconfig.org | 96 ++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/myconfig.org b/myconfig.org index aad8c28..954f478 100644 --- a/myconfig.org +++ b/myconfig.org @@ -571,63 +571,56 @@ Place your own snippets on =~/.cache/emacs/etc/yasnippet/snippets= * company Autocompletion with [[https://company-mode.github.io/][company]] *Remember*: =company-lsp= is deprecated, don't use it. - #+begin_src emacs-lisp - (use-package company - :init - (global-company-mode t) +#+begin_src emacs-lisp + (use-package company + :init + (global-company-mode t) + ;;(setq company-backends '((company-files company-keywords company-capf company-dabbrev-code company-etags company-dabbrev))) - :config - ;; (setq company-idle-delay 0) - (setq company-idle-delay - (lambda () (if (company-in-string-or-comment) nil 0.3))) - (setq company-minimum-prefix-length 3) - ;; (add-to-list 'company-backends 'company-yasnippet t) + :config + ;; (setq company-idle-delay 0) + (setq company-idle-delay + (lambda () (if (company-in-string-or-comment) nil 0.3))) + (setq company-minimum-prefix-length 3) + ;; (add-to-list 'company-backends 'company-yasnippet t) - :bind - ("C-" . company-complete-common-or-cycle) - ) - #+end_src -** company-quickhelp - In case you want popup help instead of status line help - #+begin_src emacs-lisp - (use-package company-quickhelp - :config - (company-quickhelp-mode) - ;; (setq company-quickhelp-delay nil) ; Uncoment to disable quickhelp (default 0.5) - ) - #+end_src + :bind + ("C-" . company-complete-common-or-cycle) + ) +#+end_src -** company-lsp (**DEPRECATED**) +** company-quickhelp +In case you want popup help instead of status line help #+begin_src emacs-lisp -;; (use-package company-lsp -;; :ensure -;; :config -;; (push 'company-lsp company-backends) -;; ) + (use-package company-quickhelp + :config + (company-quickhelp-mode) + ;; (setq company-quickhelp-delay nil) ; Uncoment to disable quickhelp (default 0.5) + ) #+end_src * org-mode ** org-bullets Nice bullets for org-mode - #+begin_src emacs-lisp - (use-package org-bullets - :config - (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) - ) - #+end_src +#+begin_src emacs-lisp + (use-package org-bullets + :config + (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) + ) +#+end_src * flycheck You *must* use [[https://www.flycheck.org/en/latest/][flycheck]] if you use LSP. (Flymake + LSP is hell) Syntax checking for programming languages - #+begin_src emacs-lisp - (use-package flycheck - :config - (global-set-key (kbd "C-c f p") 'flycheck-previous-error) - (global-set-key (kbd "C-c f n") 'flycheck-next-error) - :init - (global-flycheck-mode t) - ) - #+end_src +#+begin_src emacs-lisp + (use-package flycheck + :config + (global-set-key (kbd "C-c f p") 'flycheck-previous-error) + (global-set-key (kbd "C-c f n") 'flycheck-next-error) + :init + (global-flycheck-mode t) + ) +#+end_src * LSP We are using [[https://emacs-lsp.github.io/lsp-mode/][lsp-mode]] but keep an eye on [[https://github.com/joaotavora/eglot][eglot]] as an alternative. @@ -777,7 +770,6 @@ use for your debug templates! ;; ) #+end_src - ** go **WARNING**: you need to install =gopls= in your system. **WARNING**: =company-go= is deprecated, don't use it @@ -832,13 +824,13 @@ References: ** Rust - [[https://robert.kra.hn/posts/2021-02-07_rust-with-emacs/][Robert Kra Emacs Rust Configuration]] #+begin_src emacs-lisp - ;; (use-package rust-mode - ;; :hook ((rust-mode . lsp) - ;; (rust-mode . lsp-lens-mode) - ;; ) - ;; :custom - ;; (rust-format-on-save t) - ;; (lsp-rust-server 'rust-analyzer)) + (use-package rust-mode + :hook ((rust-mode . lsp) + (rust-mode . lsp-lens-mode) + ) + :custom + (rust-format-on-save t) + (lsp-rust-server 'rust-analyzer)) #+end_src ** Python