From 1e281a0b536ef0c90cecbc91519e3710a2e16e48 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 10 Jul 2024 15:11:18 +0200 Subject: emacs: add LSP + tree-sitter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- .config/doom/config.el | 9 +++++++++ .config/doom/init.el | 11 ++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to '.config/doom') diff --git a/.config/doom/config.el b/.config/doom/config.el index e42a082..f238364 100644 --- a/.config/doom/config.el +++ b/.config/doom/config.el @@ -159,6 +159,9 @@ ;;; Programming languages. +;; NOTE: workaround found in: https://github.com/emacs-lsp/lsp-mode/issues/3577#issuecomment-2064491363 +(require 'lsp-mode) + ;; Flags to be passed to `clangd' for LSP integration. (after! lsp-clangd (setq lsp-clients-clangd-args @@ -170,6 +173,12 @@ "--header-insertion-decorators=0")) (set-lsp-priority! 'clangd 2)) +;; Go: ensure `goimports' is applied on save. +(add-hook 'go-mode-hook #'lsp-deferred) +(defun lsp-go-install-save-hooks () + (add-hook 'before-save-hook #'lsp-organize-imports)) +(add-hook 'go-mode-hook #'lsp-go-install-save-hooks) + ;;; Organization ;; Setting this variable before org-mode loads. diff --git a/.config/doom/init.el b/.config/doom/init.el index b2bf5fe..281beed 100644 --- a/.config/doom/init.el +++ b/.config/doom/init.el @@ -89,6 +89,7 @@ ;;taskrunner ; taskrunner for all your projects terraform ; infrastructure as code ;;tmux ; an API for interacting with tmux + tree-sitter ;;upload ; map local to remote projects via ssh/ftp :os @@ -98,7 +99,7 @@ :lang ;;agda ; types of types of types of types... ;;beancount ; mind the GAAP - (cc +lsp) ; C > C++ == 1 + (cc +lsp +tree-sitter) ; C > C++ == 1 ;;clojure ; java with a lisp common-lisp ; if you've seen one lisp, you've seen them all ;;coq ; proofs-as-programs @@ -117,7 +118,7 @@ ;;fsharp ; ML stands for Microsoft's Language ;;fstar ; (dependent) types and (monadic) effects and Z3 ;;gdscript ; the language you waited for - go ; the hipster dialect + (go +lsp +tree-sitter) ; the hipster dialect ;;(haskell +lsp) ; a language that's lazier than I am ;;hy ; readability of scheme w/ speed of python ;;idris ; a language you can depend on @@ -144,8 +145,8 @@ ;;raku ; the artist formerly known as perl6 ;;rest ; Emacs as a REST client ;;rst ; ReST in peace - (ruby +rails +rvm +lsp) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} - (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + (ruby +rails +rvm +tree-sitter) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + (rust +lsp +tree-sitter) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() ;;scala ; java, but good ;;(scheme +guile) ; a fully conniving family of lisps sh ; she sells {ba,z,fi}sh shells on the C xor @@ -155,7 +156,7 @@ ;;terra ; Earth and Moon in alignment for performance. web ; the tubes yaml ; JSON, but readable - ;;zig ; C, but simpler + (zig +lsp +tree-sitter) ; C, but simpler :email (mu4e +gmail) -- cgit v1.2.3