Skip to content

Commit

Permalink
Merge pull request #65 from kermorgant/file-info
Browse files Browse the repository at this point in the history
add support for file_info rpc action
  • Loading branch information
kermorgant authored Sep 24, 2018
2 parents 8449e10 + 1064a78 commit 9ca0352
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions phpactor.el
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@
(view-mode 1))
(pop-to-buffer buffer)))

(cl-defun phpactor-action-return (&key value)
"Return var from Phpactor."
value)

(defvar phpactor-references nil)

(cl-defun phpactor-action-file-references (&key file_references)
Expand Down Expand Up @@ -620,5 +624,19 @@ function."
(let ((arguments (phpactor--command-argments :source :path :offset)))
(apply #'phpactor-action-dispatch (phpactor--rpc "references" (append arguments (list :mode "replace"))))))

;;;###autoload
(defun phpactor-file-information ()
"Execute Phpactor PRC file_info command to gather file informations."
(interactive)
(let ((arguments (phpactor--command-argments :path)))
(apply #'phpactor-action-dispatch (phpactor--rpc "file_info" arguments))))

;;;###autoload
(defun phpactor-insert-namespace ()
"Find namespace for current file."
(interactive)
(let ((file-info (phpactor-file-information)))
(insert (plist-get file-info :class_namespace))))

(provide 'phpactor)
;;; phpactor.el ends here

0 comments on commit 9ca0352

Please sign in to comment.