From 627d902ce8554480fbb8cea40c1b92c9edbbec17 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Tue, 23 May 2023 17:12:50 +0200 Subject: [PATCH] eglot tweaks, add terraform-ls --- home-manager/modules/emacs/config.org | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/home-manager/modules/emacs/config.org b/home-manager/modules/emacs/config.org index c78ce39..82a4ec3 100644 --- a/home-manager/modules/emacs/config.org +++ b/home-manager/modules/emacs/config.org @@ -1008,7 +1008,21 @@ Visualise git changes in the gutter, next to the line numbers (add-to-list 'eglot-server-programs '(conf-toml-mode . ("taplo" "lsp" "stdio")) '(elixir-mode elixir-ts-mode heex-ts-mode . ("elixir-ls"))) - (setq eglot-autoshutdown t)) + (setq eglot-autoshutdown t + eldoc-echo-area-use-multiline-p 0.1) + :hook + (eglot-managed-mode . (lambda () + (eglot-inlay-hints-mode 1) + (define-key eglot-mode-map (kbd "C-c l a") 'eglot-code-actions) + (define-key eglot-mode-map (kbd "C-c l f") 'eglot-format) + (define-key eglot-mode-map (kbd "C-c l h") 'eldoc) + (define-key eglot-mode-map (kbd "C-c l i") 'eglot-find-implementation) + (define-key eglot-mode-map (kbd "C-c l r") 'eglot-rename) + (define-key eglot-mode-map (kbd "C-c l t") 'eglot-find-typeDefinition) + (define-key eglot-mode-map (kbd "C-c l w d") 'eglot-list-connections) + (define-key eglot-mode-map (kbd "C-c l w r") 'eglot-reconnect) + (define-key eglot-mode-map (kbd "C-c l w q") 'eglot-shutdown) + (define-key eglot-mode-map (kbd "C-c l y") 'eglot-inlay-hints-mode)))) #+end_src [[https://github.com/nemethf/eglot-x][eglot-x]] adds support for some LSP extensions to =eglot= @@ -1377,7 +1391,7 @@ Tell =nil= to use =nixpkgs-fmt= for formatting nix files. (with-eval-after-load 'eglot (add-to-list 'eglot-server-programs '(nix-mode . ("nil" :initializationOptions - `(:nil (:formatting (:command ("nixpkgs-fmt")))))))) + `(:nil (:formatting (:command ["nixpkgs-fmt"]))))))) #+end_src *** Common Lisp @@ -1415,6 +1429,14 @@ Similar to =lisp=, there is [[https://github.com/clojure-emacs/cider][CIDER]] (C :hook (terraform-mode . eglot-ensure)) #+end_src +Register =terraform-ls= with eglot + +#+begin_src emacs-lisp + (with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + '(terraform-mode . ("terraform-ls" "serve")))) +#+end_src + *** Fish [[https://github.com/wwwjfy/emacs-fish][fish-mode]] provides a major mode for fish shell scripts