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:
parent
ce65645fb8
commit
d4eb7e31ac
3 changed files with 31 additions and 5 deletions
|
@ -212,11 +212,15 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
|
||||||
|
|
||||||
(defun +lookup-xref-definitions-backend-fn (identifier)
|
(defun +lookup-xref-definitions-backend-fn (identifier)
|
||||||
"Non-interactive wrapper for `xref-find-definitions'"
|
"Non-interactive wrapper for `xref-find-definitions'"
|
||||||
(+lookup--xref-show 'xref-backend-definitions identifier #'xref--show-defs))
|
(condition-case _
|
||||||
|
(+lookup--xref-show 'xref-backend-definitions identifier #'xref--show-defs)
|
||||||
|
(cl-no-applicable-method nil)))
|
||||||
|
|
||||||
(defun +lookup-xref-references-backend-fn (identifier)
|
(defun +lookup-xref-references-backend-fn (identifier)
|
||||||
"Non-interactive wrapper for `xref-find-references'"
|
"Non-interactive wrapper for `xref-find-references'"
|
||||||
(+lookup--xref-show 'xref-backend-references identifier #'xref--show-xrefs))
|
(condition-case _
|
||||||
|
(+lookup--xref-show 'xref-backend-references identifier #'xref--show-xrefs)
|
||||||
|
(cl-no-applicable-method nil)))
|
||||||
|
|
||||||
(defun +lookup-dumb-jump-backend-fn (_identifier)
|
(defun +lookup-dumb-jump-backend-fn (_identifier)
|
||||||
"Look up the symbol at point (or selection) with `dumb-jump', which conducts a
|
"Look up the symbol at point (or selection) with `dumb-jump', which conducts a
|
||||||
|
|
|
@ -58,9 +58,9 @@ about it (it will be logged to *Messages* however).")
|
||||||
lsp-groovy-server-file (concat lsp-server-install-dir "groovy-language-server-all.jar"))
|
lsp-groovy-server-file (concat lsp-server-install-dir "groovy-language-server-all.jar"))
|
||||||
|
|
||||||
(set-popup-rule! "^\\*lsp-help" :size 0.35 :quit t :select t)
|
(set-popup-rule! "^\\*lsp-help" :size 0.35 :quit t :select t)
|
||||||
(set-lookup-handlers! 'lsp-mode :async t
|
(set-lookup-handlers! 'lsp-mode
|
||||||
;; NOTE :definitions and :references aren't needed. LSP is integrated into
|
:definition #'+lsp-lookup-definition-handler
|
||||||
;; xref, which the lookup module has first class support for.
|
:references #'+lsp-lookup-references-handler
|
||||||
:documentation #'lsp-describe-thing-at-point
|
:documentation #'lsp-describe-thing-at-point
|
||||||
:implementations #'lsp-find-implementation
|
:implementations #'lsp-find-implementation
|
||||||
:type-definition #'lsp-find-type-definition)
|
:type-definition #'lsp-find-type-definition)
|
||||||
|
|
|
@ -49,3 +49,25 @@
|
||||||
(car workspaces)))
|
(car workspaces)))
|
||||||
(lsp-mode +1))
|
(lsp-mode +1))
|
||||||
(setf (lsp--client-priority match) old-priority)))))
|
(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))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue