summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/mm-lsp.el
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-10-16 22:04:33 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-10-16 22:04:33 +0200
commit0ee7fa9c382ae30295f0b8d88457f7856c7ff800 (patch)
tree6b5a0cf01fa0bfa4d01b0134b268f5d993055c0b /.config/emacs/modules/mm-lsp.el
parentd452ae1347b3711bc0a7ac80cfa2c37d9d63836e (diff)
emacs: Overhaul configuration completely
Diffstat (limited to '.config/emacs/modules/mm-lsp.el')
-rw-r--r--.config/emacs/modules/mm-lsp.el41
1 files changed, 41 insertions, 0 deletions
diff --git a/.config/emacs/modules/mm-lsp.el b/.config/emacs/modules/mm-lsp.el
new file mode 100644
index 0000000..2e0feac
--- /dev/null
+++ b/.config/emacs/modules/mm-lsp.el
@@ -0,0 +1,41 @@
+;;; mm-lsp.el --- Language Server Protocol configuration -*- lexical-binding: t; -*-
+
+;;; Configure LSP
+
+(defun mm-lsp-eglot-no-inlay-hints ()
+ "Disable inlay hints when `eglot' is enabled."
+ (eglot-inlay-hints-mode -1))
+
+(use-package eglot
+ :hook (((c-mode c-ts-mode
+ c++-mode c++-ts-mode
+ go-ts-mode
+ python-mode python-ts-mode
+ js-mode js-ts-mode)
+ . eglot-ensure)
+ (eglot-managed-mode . mm-lsp-eglot-no-inlay-hints))
+ :init
+ (fset #'jsonrpc--log-event #'ignore)
+ :custom
+ (eglot-events-buffer 0)
+ (eglot-extend-to-xref t)
+ :config
+ (add-to-list 'eglot-stay-out-of 'flymake)
+ (add-to-list 'eglot-server-programs
+ '((c-mode c-ts-mode c++-mode c++-ts-mode)
+ . ("clangd" "--header-insertion=never"))))
+
+
+;;; Use Tempel for Snippets
+
+(defun mm-lsp-eglot-tempel-enable ()
+ "Enable `eglot-tempel-mode'.
+If `eglot-tempel-mode' is already enabled this function does nothing."
+ (unless (default-value eglot-tempel-mode)
+ (eglot-tempel-mode)))
+
+(use-package eglot-tempel
+ :after eglot
+ :hook (eglot-managed-mode . mm-lsp-eglot-tempel-enable))
+
+(provide 'mm-lsp)