-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip : xref backend experiment #128
base: master
Are you sure you want to change the base?
Conversation
can be tested with such function (defun mk/phpactor-xref ()
"Activates xref backend using phpactor."
(make-local-variable 'xref-prompt-for-identifier)
(setq xref-prompt-for-identifier nil)
(add-hook 'xref-backend-functions #'phpactor-xref-backend nil t)) |
phpactor.el
Outdated
@@ -821,5 +832,8 @@ function." | |||
(let ((arguments (phpactor--command-argments :source :path :offset))) | |||
(apply #'phpactor-action-dispatch (phpactor--rpc "change_visibility" arguments)))) | |||
|
|||
(when phpactor-use-xref | |||
(require 'phpactor-xref)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can replace (when (require ...))
with autoload
.
(autoload 'phpactor-xref-backend "phpactor-xref"
"Phpactor backend for Xref.")
phpactor-xref.el
Outdated
;; Created: 05 Aug 2019 | ||
;; Version: 0.1.0 | ||
;; Keywords: tools, php | ||
;; Package-Requires: ((phpactor "0.1.0")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add (seq "2")
into Package-Requires
.
This is because Phpactor targets Emacs 24.4 and may not include the seq
package.
;; xref backend using Phpactor. | ||
|
||
;;; Code: | ||
(require 'xref) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add (require 'seq)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the review !
phpactor-xref.el
Outdated
(xref-make (map-elt candidate 'file) | ||
(xref-make-file-location (map-elt candidate 'file) | ||
(map-elt candidate 'line) | ||
0))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having 0 here for the column is annoying as we already have the point position from the start of file.
(push (list (cons 'file path) | ||
(cons 'line (plist-get reference :line_no)) | ||
;; (cons 'symbol symbol) | ||
;; (cons 'match match) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe worth trying to fetch content of line at :line_no, which could permit to get a preview while listing candidates in minibuffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was already given using :line
f3cc067
to
26ec6ac
Compare
fixed 2 small thing regarding references but still need to make find-definition behave correctly |
|
||
(defun phpactor--xref-find-definitions () | ||
"Find definitions or jump directly when only one found." | ||
(phpactor-goto-definition)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this works but with a mysterious Wrong type argument: listp 2070
Thanks Nicolas Petton for inspiring this with your work on xref-js2.
479e30f
to
13e37e9
Compare
I wanted to see how it would behave.
attention, this is based on branch feature/phpactor-executable-defcustom-take2