Set lsp lookup handlers rather than remapping them

Now that the lookup module has beter deferred handler support.
This commit is contained in:
Henrik Lissner 2019-05-03 20:03:32 -04:00
parent 90922caad0
commit 96ca04d488
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 10 additions and 10 deletions

View file

@ -96,7 +96,11 @@ argument: the identifier at point.")
(after! xref (after! xref
;; We already have `projectile-find-tag' and `evil-jump-to-tag', no need for ;; We already have `projectile-find-tag' and `evil-jump-to-tag', no need for
;; xref to be one too. ;; xref to be one too.
(remove-hook 'xref-backend-functions #'etags--xref-backend)) (remove-hook 'xref-backend-functions #'etags--xref-backend)
;; The lookup commands are superior, and will consult xref if there are no
;; better backends available.
(global-set-key [remap xref-find-definitions] #'+lookup/definition)
(global-set-key [remap xref-find-references] #'+lookup/references))
;; Use `better-jumper' instead of xref's marker stack ;; Use `better-jumper' instead of xref's marker stack
(advice-add #'xref-push-marker-stack :around #'doom*set-jump) (advice-add #'xref-push-marker-stack :around #'doom*set-jump)

View file

@ -5,8 +5,8 @@
lsp-keep-workspace-alive nil) lsp-keep-workspace-alive nil)
(after! lsp-mode (after! lsp-mode
(define-key lsp-mode-map (set-lookup-handlers! 'lsp-mode :async t
[remap +lookup/documentation] #'lsp-describe-thing-at-point) :documentation 'lsp-describe-thing-at-point)
;; Don't prompt to restart LSP servers while quitting Emacs ;; Don't prompt to restart LSP servers while quitting Emacs
(add-hook! 'kill-emacs-hook (setq lsp-restart 'ignore))) (add-hook! 'kill-emacs-hook (setq lsp-restart 'ignore)))
@ -20,13 +20,9 @@
lsp-ui-doc-max-width 35 lsp-ui-doc-max-width 35
lsp-ui-sideline-ignore-duplicate t) lsp-ui-sideline-ignore-duplicate t)
(define-key! lsp-ui-mode-map (set-lookup-handlers! 'lsp-ui-mode :async t
[remap xref-find-definitions] #'lsp-ui-peek-find-definitions :definition 'lsp-ui-peek-find-definitions
[remap xref-find-references] #'lsp-ui-peek-find-references :references 'lsp-ui-peek-find-references))
;; `set-lookup-handlers!' won't work for lsp-ui-peek commands, because they
;; don't switch buffers
[remap +lookup/definition] #'lsp-ui-peek-find-definitions
[remap +lookup/references] #'lsp-ui-peek-find-references))
(def-package! company-lsp (def-package! company-lsp