-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add +tools/lsp layer for lsp-mode & lsp-ui
This is a starting point to bring LSP ecosystem into spacemacs.
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
(defconst lsp-packages | ||
'( | ||
company-lsp | ||
(helm-xref :requires helm) | ||
(ivy-xref :requires ivy) | ||
lsp-mode | ||
lsp-ui | ||
)) | ||
|
||
(defun lsp/init-company-lsp () | ||
(use-package company-lsp | ||
:defer t | ||
:init | ||
;; Language servers have better idea filtering and sorting, | ||
;; don't filter results on the client side. | ||
(setq company-transformers nil | ||
company-lsp-async t | ||
company-lsp-cache-candidates nil) | ||
;; (spacemacs|add-company-backends :backends company-lsp :modes c-mode-common) | ||
)) | ||
|
||
(defun lsp/init-helm-xref () | ||
(use-package helm-xref | ||
:config | ||
;; This is required to make xref-find-references not give a prompt. | ||
;; xref-find-references asks the identifier (which has no text property) and then passes it to lsp-mode, which requires the text property at point to locate the references. | ||
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29619 | ||
(setq xref-prompt-for-identifier | ||
'(not xref-find-definitions xref-find-definitions-other-window xref-find-definitions-other-frame xref-find-references spacemacs/jump-to-definition)) | ||
|
||
;; Use helm-xref to display xref.el results. | ||
(setq xref-show-xrefs-function 'helm-xref-show-xrefs) | ||
)) | ||
|
||
(defun lsp/init-ivy-xref () | ||
(use-package ivy-xref | ||
:config | ||
(setq xref-prompt-for-identifier | ||
'(not xref-find-definitions xref-find-definitions-other-window xref-find-definitions-other-frame xref-find-references spacemacs/jump-to-definition)) | ||
|
||
;; Use ivy-xref to display xref.el results. | ||
(setq xref-show-xrefs-function 'ivy-xref-show-xrefs) | ||
)) | ||
|
||
(defun lsp/init-lsp-mode () | ||
(use-package lsp-mode | ||
:config | ||
(require 'lsp-imenu) | ||
(add-hook 'lsp-after-open-hook #'lsp-enable-imenu) | ||
;; Disable lsp-flycheck.el in favor of lsp-ui-flycheck.el | ||
(setq lsp-enable-flycheck nil) | ||
)) | ||
|
||
(defun lsp/init-lsp-ui () | ||
(use-package lsp-ui | ||
:after lsp-mode | ||
:after markdown-mode | ||
:config | ||
(add-hook 'lsp-mode-hook #'lsp-ui-mode) | ||
)) |