summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/mm-lsp.el
blob: 2e0feac35fe5b0f49cd5f25b916f419738c02af2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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"))))

^L
;;; 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)