diff --git a/phpactor-xref.el b/phpactor-xref.el index d5b6e97..e45eb1e 100644 --- a/phpactor-xref.el +++ b/phpactor-xref.el @@ -42,6 +42,10 @@ (cl-defmethod xref-backend-definitions ((_backend (eql phpactor-xref)) symbol) (phpactor-xref--find-definitions)) +(defun phpactor--xref-find-definitions () + "Find definitions or jump directly when only one found." + (phpactor-goto-definition)) + (cl-defmethod xref-backend-identifier-completion-table ((_backend (eql phpactor-xref))) "Return a list of terms for completions taken from the symbols in the current buffer. The current implementation returns all the words in the buffer, @@ -54,12 +58,6 @@ which is really sub optimal." (phpactor-xref--make-xref candidate)) (phpactor-xref--find-candidates))) -(defun phpactor-xref--find-definitions() - "Return a list of candidates matching SYMBOL." - (seq-map (lambda (candidate) - (phpactor-xref--make-xref candidate)) - (phpactor-xref--find-candidates))) - (defun phpactor-xref--make-xref (candidate) "Return a new Xref object built from CANDIDATE." (xref-make (map-elt candidate 'match)