Skip to content

Commit 1064a78

Browse files
committed
add support for file_info rpc action + insert-namespace function
1 parent 0d26c2d commit 1064a78

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)
@@ -593,5 +597,19 @@ function."
593597
(let ((arguments (phpactor--command-argments :source :path :offset)))
594598
(apply #'phpactor-action-dispatch (phpactor--rpc "references" (append arguments (list :mode "replace"))))))
595599

600+
;;;###autoload
601+
(defun phpactor-file-information ()
602+
"Execute Phpactor PRC file_info command to gather file informations."
603+
(interactive)
604+
(let ((arguments (phpactor--command-argments :path)))
605+
(apply #'phpactor-action-dispatch (phpactor--rpc "file_info" arguments))))
606+
607+
;;;###autoload
608+
(defun phpactor-insert-namespace ()
609+
"Find namespace for current file."
610+
(interactive)
611+
(let ((file-info (phpactor-file-information)))
612+
(insert (plist-get file-info :class_namespace))))
613+
596614
(provide 'phpactor)
597615
;;; phpactor.el ends here

0 commit comments

Comments
 (0)