-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-lsp.el
112 lines (98 loc) · 3.54 KB
/
init-lsp.el
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
;;; init-lsp --- Initialize Language Server Mode.
;;; Commentary:
;;;
;;; Code:
;; happy flycheck
(eval-when-compile
(add-to-list 'load-path (expand-file-name "straight/repos/use-package" user-emacs-directory))
(require 'use-package))
(use-package yasnippet
:straight t
:commands yas-minor-mode)
(use-package lsp-mode
:straight (lsp-mode :host github :repo "emacs-lsp/lsp-mode")
:hook
((c++-mode . lsp)
;; lsp-pyright
;; (python-mode . lsp)
(rust-mode . lsp)
(web-mode . lsp)
(rust-mode . (lambda()
(add-hook 'before-save-hook #'lsp-format-buffer t t)))
(php-mode . lsp)
(cmake-mode . lsp)
(go-mode . lsp)
(go-mode . (lambda ()
"Set up before-save hooks to format buffer and add/delete imports."
;; Make sure you don't have other gofmt/goimports hooks enabled.
(add-hook 'before-save-hook #'lsp-format-buffer t t)
(add-hook 'before-save-hook #'lsp-organize-imports t t)))
(dart-mode . lsp)
(lsp-mode . lsp-lens-mode)
(lsp-mode . lsp-enable-which-key-integration)
(lsp-mode . yas-minor-mode))
:commands lsp
:custom
(lsp-keymap-prefix "C-c l")
(lsp-rust-server 'rust-analyzer)
(lsp-clients-clangd-executable "/opt/homebrew/opt/llvm/bin/clangd")
:after (company flycheck))
(use-package with-venv
:straight t)
(use-package lsp-pyright
:straight t
:after (lsp-mode with-venv)
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
(setq lsp-pyright-venv-path (with-venv--find-venv-dir))
(lsp)))
:custom
(lsp-pyright-use-library-code-for-types t) ;; set this to nil if getting too many false positive type errors
(lsp-pyright-stub-path (concat (getenv "HOME") "/.local/src/python-type-stubs")))
(use-package lsp-java
:straight t
:after lsp-mode
:custom
;; We are using Java8 and the 0.57 is the latest version to support Java 8,
;; otherwise Java 11 is required.
(lsp-java-jdt-download-url "https://download.eclipse.org/jdtls/milestones/0.57.0/jdt-language-server-0.57.0-202006172108.tar.gz")
(lsp-java-configuration-runtimes '[(:name "JavaSE-1.8"
:path "/Users/wh/.sdkman/candidates/java/8.0.292.hs-adpt"
:default t)])
:hook
(java-mode . lsp))
(use-package lsp-java-lambok
:straight (lsp-java-lambok :host github :repo "sei40kr/lsp-java-lombok")
:after lsp-java
:hook
(java-mode . lsp-java-lombok))
;; Add metals backend for lsp-mode
(use-package lsp-metals
:straight (lsp-metals :host github :repo "emacs-lsp/lsp-metals")
:custom (lsp-metals-treeview-show-when-views-received t)
:after lsp-mode
:hook
;; DO NOT move this to lsp-mode, that will break use-package defer
(scala-mode . lsp))
(use-package lsp-sourcekit
:straight t
:after lsp-mode
:custom
(lsp-sourcekit-executable "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp"))
(use-package dap-mode
:init
(dap-mode 1)
(dap-ui-mode 1)
(require 'dap-go)
(dap-go-setup)
:custom
;; (dap-go-debug-program `("node" ,(expand-file-name "~/.vscode/extensions/ms-vscode.go-0.9.2/out/src/debugAdapter/goDebug.js")))
(dap-auto-configure-features '(sessions locals controls tooltip))
(dap-print-io t)
:after (lsp-mode))
(use-package lsp-ui :after lsp-mode :straight t :commands lsp-ui-mode)
(use-package lsp-ivy :after lsp-mode :straight t :commands lsp-ivy-workspace-symbol)
(use-package lsp-dart
:straight t)
(provide 'init-lsp)
;;; init-lsp.el ends here