Skip to content

Commit 9ca0352

Browse files
authored
Merge pull request #65 from kermorgant/file-info
add support for file_info rpc action
2 parents 8449e10 + 1064a78 commit 9ca0352

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

phpactor.el

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@
272272
(view-mode 1))
273273
(pop-to-buffer buffer)))
274274

275+
(cl-defun phpactor-action-return (&key value)
276+
"Return var from Phpactor."
277+
value)
278+
275279
(defvar phpactor-references nil)
276280

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

627+
;;;###autoload
628+
(defun phpactor-file-information ()
629+
"Execute Phpactor PRC file_info command to gather file informations."
630+
(interactive)
631+
(let ((arguments (phpactor--command-argments :path)))
632+
(apply #'phpactor-action-dispatch (phpactor--rpc "file_info" arguments))))
633+
634+
;;;###autoload
635+
(defun phpactor-insert-namespace ()
636+
"Find namespace for current file."
637+
(interactive)
638+
(let ((file-info (phpactor-file-information)))
639+
(insert (plist-get file-info :class_namespace))))
640+
623641
(provide 'phpactor)
624642
;;; phpactor.el ends here

0 commit comments

Comments
 (0)