~hristoast/dot-emacs

ref: 2bb9a7dd5ca8cb281c4f8a9a8bea0508464b5c63 dot-emacs/lib/h-lsp.el -rw-r--r-- 2.4 KiB
2bb9a7ddHristos N. Triantafillou A post-install note 4 months ago
                                                                                
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
;;; h-lsp.el --- lsp-mode and related
;;; Commentary:
;; Packages related to lsp-mode
;;; Code:

(if (getenv "EMACS_EGLOT")
  ;; Emacs Polyglot: an Emacs LSP client that stays out of your way:
  ;; https://github.com/joaotavora/eglot
  (use-package eglot :straight t
    ;; Hook into modes that I always want LSP functionality in.
    :hook
    ((gdscript-mode . eglot-ensure)
     (go-mode . eglot-ensure)
     (web-mode . eglot-ensure)
     (c-mode . eglot-ensure)
     (c++-mode . eglot-ensure)
     (js-mode . eglot-ensure)
     (python-mode . eglot-ensure)
     (ruby-mode . eglot-ensure)
     (sh-mode . eglot-ensure))
    :init
    (setq eglot-workspace-configuration
          '((pyls
             (plugins
              (mccabe
               (enabled . nil))
              (pycodestyle
               (enabled . nil))
              (pydocstyle
               (enabled . t))
              (jedi_completion
               (fuzzy . t)
               (follow_builtin_imports . :json-false)))))))

  (progn
      ;; Emacs client/library for the Language Server Protocol
      ;; https://github.com/emacs-lsp/lsp-mode
      (use-package lsp-mode
        :straight t
        :hook ((gdscript-mode . lsp-deferred)
               (go-mode . (lambda ()
                            (progn
                              (lsp-deferred)
                              (lsp-register-custom-settings
                               '(("gopls.completeUnimported" t t)
                                 ("gopls.staticcheck" t t))))))
               (c-mode . lsp-deferred)
               (c++-mode . lsp-deferred)
               (web-mode . lsp-deferred)
               (js-mode . lsp-deferred)
               (python-mode . lsp-deferred)
               (ruby-mode . lsp-deferred)
               (sh-mode . lsp-deferred))
        :init
        ;; Knob to disable the headerline breadcrum stuff
        (if (getenv "EMACS_LSP_NO_HEADERLINE_BREADCRUMB")
            (lsp-headerline-breadcrumb-mode 0))
        (setq
         lsp-prefer-flymake nil
         lsp-clients-python-library-directories
         (concat (getenv "HOME") ".local/lib/python3.8/site-packages"))
        :config
        ;; Disable python "features" that are useless to me
        (setq lsp-pyls-plugins-mccabe-enabled nil
              lsp-pyls-plugins-pycodestyle-enabled nil))

      ;; UI integrations for lsp-mode
      ;; https://emacs-lsp.github.io/lsp-ui/
      (use-package lsp-ui :straight t)))

;;; h-lsp.el ends here