Fix #4771: give lsp-find-* precedence over fallbacks

LSP lookup handlers should have the highest precedence, but this wasn't
the case due to a regression in 430d628.
This commit is contained in:
Henrik Lissner 2021-03-27 21:41:15 -04:00
parent ce65645fb8
commit d4eb7e31ac
3 changed files with 31 additions and 5 deletions

View file

@ -49,3 +49,25 @@
(car workspaces)))
(lsp-mode +1))
(setf (lsp--client-priority match) old-priority)))))
;;;###autoload
(defun +lsp-lookup-definition-handler ()
"Find definition of the symbol at point using LSP."
(interactive)
(when-let (loc (lsp-request "textDocument/definition"
(lsp--text-document-position-params)))
(lsp-show-xrefs (lsp--locations-to-xref-items loc) nil nil)
t))
;;;###autoload
(defun +lsp-lookup-references-handler (&optional include-declaration)
"Find project-wide references of the symbol at point using LSP."
(interactive "P")
(when-let
(loc (lsp-request "textDocument/references"
(append (lsp--text-document-position-params)
(list
:context `(:includeDeclaration
,(lsp-json-bool include-declaration))))))
(lsp-show-xrefs (lsp--locations-to-xref-items loc) nil t)
t))