summaryrefslogtreecommitdiffstats
path: root/lisp/ravi-init-lsp.el
blob: 27c8996970bc77512f5ecc2faa1ec42a4f3641e7 (plain)
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
;;; ravi-init-lsp.el --- lsp-mode support            -*- lexical-binding: t; -*-

;; Copyright (C) 2021  Ravi Kiran

;; Author: Ravi Kiran <ravi@cramer>
;; Keywords:

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; LSP mode support

;;; Code:

;; 4k is too low; use 1MB minimum for interprocess communication
(setq read-process-output-max (* 1024 1024))

(use-package lsp-mode
  :init
  (setq lsp-keymap-prefix "H-l")
  :hook ((c-mode-hook .  lsp-deferred)
         (c++-mode-hook . lsp-deferred)
         ;; (python-mode . lsp-deferred)
         (lsp-mode-hook . lsp-enable-which-key-integration))
  :commands (lsp lsp-deferred)
  :bind (:map lsp-mode-map
              ("M-<RET>" . lsp-execute-code-action)) ; perhaps helm-lsp-code-actions?
  :config
  (setq lsp-enable-file-watchers nil) ; Most of my repos are too large
  (setq lsp-enable-indentation nil)   ; I'll handle indentation myself
  (setq lsp-headerline-breadcrumb-enable nil)
  (use-package helm-lsp
    :if (equal ravi/use-selection-system 'helm)
    :commands helm-lsp-workspace-symbol)
  (use-package consult-lsp
    :if (member ravi/use-selection-system '(selectrum vertico))
    :commands (consult-lsp-diagnostics consult-lsp-symbols))
  (use-package lsp-ui
    :commands lsp-ui-mode
    :hook (lsp-mode . lsp-ui-mode)
    :bind (:map lsp-ui-mode-map
                ("C-c i" . lsp-ui-imenu))
    :config
    (setq lsp-ui-doc-enable t)
    (setq lsp-ui-peek-show-directory t)
    (setq lsp-ui-peek-enable t)))

(use-package dap-mode
  :defer t
  :after lsp-mode
  :config
  (dap-auto-configure-mode))

(provide 'ravi-init-lsp)
;;; ravi-init-lsp.el ends here