diff --git a/layers/+tools/lsp/funcs.el b/layers/+tools/lsp/funcs.el new file mode 100644 index 000000000000..06603427b574 --- /dev/null +++ b/layers/+tools/lsp/funcs.el @@ -0,0 +1,18 @@ +(defun lsp//sync-peek-face () + (set-face-attribute 'lsp-ui-peek-list nil + :background (face-attribute 'hl-line :background)) + (set-face-attribute 'lsp-ui-peek-peek nil + :background (face-attribute 'hl-line :background)) + (set-face-attribute 'lsp-ui-peek-selection nil + :background (face-attribute 'highlight :background) + :foreground (face-attribute 'default :foreground)) + (set-face-attribute 'lsp-ui-peek-filename nil + :foreground (face-attribute 'font-lock-constant-face :foreground)) + (set-face-attribute 'lsp-ui-peek-highlight nil + :background (face-attribute 'highlight :background) + :foreground (face-attribute 'highlight :foreground) + :distant-foreground (face-attribute 'highlight :foreground)) + (set-face-attribute 'lsp-ui-peek-header nil + :background (face-attribute 'highlight :background) + :foreground (face-attribute 'default :foreground)) + ) diff --git a/layers/+tools/lsp/packages.el b/layers/+tools/lsp/packages.el index fde656b0b218..6abdbb9b42fd 100644 --- a/layers/+tools/lsp/packages.el +++ b/layers/+tools/lsp/packages.el @@ -1,6 +1,6 @@ (defconst lsp-packages '( - company-lsp + (company-lsp :requires company) (helm-xref :requires helm) (ivy-xref :requires ivy) lsp-mode @@ -21,40 +21,50 @@ (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) - )) + :defer t + :init + (progn + ;; 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)) + :defer t + :init + (progn + (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) - )) + ;; 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) - )) + (progn + (add-hook 'lsp-mode-hook #'lsp-ui-mode) + + (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) + + (spacemacs|diminish lsp-mode " Ⓛ" " L") + ))) (defun lsp/init-lsp-ui () (use-package lsp-ui - :after lsp-mode - :after markdown-mode :config - (add-hook 'lsp-mode-hook #'lsp-ui-mode) - )) + (progn + (lsp//sync-peek-face) + (add-hook 'spacemacs-post-theme-change-hook #'lsp//sync-peek-face) + )))