Skip to content

Commit

Permalink
use phpactor-goto-definition for definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Kermorgant authored and kermorgant committed Aug 25, 2019
1 parent d0e8e03 commit 13e37e9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions phpactor-xref.el
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit 13e37e9

Please sign in to comment.