tools/lsp: minor refactor

And several updates necessary for ff3c9777e.
This commit is contained in:
Henrik Lissner 2021-05-16 21:17:16 -04:00
parent 059a70b74b
commit e2077c823a

View file

@ -1,6 +1,7 @@
;;; tools/lsp/+lsp.el -*- lexical-binding: t; -*-
(defvar +lsp-company-backends (if (featurep! :editor snippets)
(defvar +lsp-company-backends
(if (featurep! :editor snippets)
'(:separate company-capf company-yasnippet)
'company-capf)
"The backends to prepend to `company-backends' in `lsp-mode' buffers.
@ -44,7 +45,7 @@ about it (it will be logged to *Messages* however).")
(setq lsp-keymap-prefix nil))
:config
(pushnew! doom-debug-variables 'lsp-log-io 'lsp-print-performance)
(add-to-list 'doom-debug-variables 'lsp-log-io)
(setq lsp-intelephense-storage-path (concat doom-etc-dir "lsp-intelephense/")
lsp-vetur-global-snippets-dir
@ -155,16 +156,31 @@ server getting expensively restarted when reverting buffers."
(use-package! lsp-ui
:defer t
:hook (lsp-mode . lsp-ui-mode)
:hook (lsp-ui . lsp-ui-sideline-mode)
:hook (lsp-ui . lsp-ui-doc-mode)
:config
;; For some reason `lsp-ui' doesn't actually use the `lsp-ui-doc-enable' and
;; `lsp-ui-sideline-enable' variables, so we fix that.
(defadvice! +lsp--ui-doc-only-if-enabled-a (&rest _)
:before-while #'lsp-ui-doc-mode
lsp-ui-doc-enable)
(defadvice! +lsp--ui-sideline-only-if-enabled-a (&rest _)
:before-while 'lsp-ui-sideline-mode
lsp-ui-sideline-enable)
(when (featurep! +peek)
(set-lookup-handlers! 'lsp-ui-mode
:definition 'lsp-ui-peek-find-definitions
:implementations 'lsp-ui-peek-find-implementation
:references 'lsp-ui-peek-find-references))
(setq lsp-ui-doc-max-height 8
lsp-ui-doc-max-width 35
lsp-ui-sideline-ignore-duplicate t
;; lsp-ui-doc is redundant with and more invasive than
;; `+lookup/documentation'
lsp-ui-doc-enable nil
lsp-ui-doc-show-with-mouse nil ; don't disappear on mouseover
lsp-ui-doc-position 'at-point
lsp-ui-sideline-ignore-duplicate t
;; Don't show symbol definitions in the sideline. They are pretty noisy,
;; and there is a bug preventing Flycheck errors from being shown (the
;; errors flash briefly and then disappear).
@ -177,13 +193,7 @@ server getting expensively restarted when reverting buffers."
"j" #'lsp-ui-peek--select-next
"k" #'lsp-ui-peek--select-prev
"C-k" #'lsp-ui-peek--select-prev-file
"C-j" #'lsp-ui-peek--select-next-file)
(when (featurep! +peek)
(set-lookup-handlers! 'lsp-ui-mode :async t
:definition 'lsp-ui-peek-find-definitions
:implementations 'lsp-ui-peek-find-implementation
:references 'lsp-ui-peek-find-references)))
"C-j" #'lsp-ui-peek--select-next-file))
(use-package! helm-lsp