Skip to content

Commit 782a5ee

Browse files
kermorgantzonuexe
authored andcommitted
add support for hover rpc action + documentation for it with eldoc (#102)
1 parent c4bc2d0 commit 782a5ee

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

README.org

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,23 @@ Alternatively, you can install Phpactor on your own and configure `phpactor-exec
3535

3636

3737
** Configuration
38+
*** eldoc integration
39+
40+
#+BEGIN_SRC elisp
41+
(add-hook 'php-mode-hook
42+
(lambda ()
43+
(make-local-variable 'eldoc-documentation-function)
44+
(setq eldoc-documentation-function
45+
'phpactor-hover)))
46+
#+END_SRC
47+
48+
*** phpactor itself
3849
See https://phpactor.github.io/phpactor/configuration.html
3950

4051
** Troubleshooting
4152

4253
You can run ``phpactor-status`` while visiting a project file.
4354

4455
If needed, configure [[https://github.com/emacs-php/php-mode/blob/1f04813f46219e626b385d0d96abefad914bfae0/php-project.el#L54][the way the project root is detected]] via .dir-locals.el
56+
57+
"*Phpactor Output*" buffer might also contain useful informations.

phpactor.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,5 +764,12 @@ function."
764764
(let ((arguments (phpactor--command-argments :source :offset :path)))
765765
(apply #'phpactor-action-dispatch (phpactor--rpc "extract_constant" arguments))))
766766

767+
;;;###autoload
768+
(defun phpactor-hover ()
769+
"Execute Phpactor RPC hover action."
770+
(interactive)
771+
(let ((arguments (phpactor--command-argments :source :offset)))
772+
(apply #'phpactor-action-dispatch (phpactor--rpc "hover" arguments))))
773+
767774
(provide 'phpactor)
768775
;;; phpactor.el ends here

0 commit comments

Comments
 (0)