phpactor.el icon indicating copy to clipboard operation
phpactor.el copied to clipboard

Implement RPC features

Open zonuexe opened this issue 6 years ago • 8 comments

https://phpactor.github.io/phpactor/rpc.html

Editor Actions

  • [ ] return
  • [ ] return_choice
  • [x] echo #3
  • [ ] error
  • [x] collection #39
  • [x] open_file #3
  • [x] close_file #39
  • [ ] file_references
  • [x] input_callback 51f82e8f7a7967a9bbc7813fc8aab7d92fee7401
  • [x] information #3
  • [x] replace_file_source

Phpactor Commands

  • [x] complete
  • [ ] class_search
  • [x] goto_definition 22e285e097cc20b9ecc83786a99ad29c55e0b9fb
  • [x] copy_class https://github.com/emacs-php/phpactor.el/pull/10
  • [x] move_class https://github.com/emacs-php/phpactor.el/pull/10
  • [x] offset_info
  • [x] transform
  • [x] class_new
  • [x] class_inflect
  • [ ] references
  • [x] extract_constant
  • [ ] generate_method
  • [x] generate_accessor e16cec9e0480a37142b65ddca3db60695c597336
  • [x] context_menu https://github.com/emacs-php/phpactor.el/pull/24
  • [x] navigate
  • [x] status b6f68f704ed48b768140e08b4c392fe5b050126a
  • [x] import_class https://github.com/emacs-php/phpactor.el/pull/34 by @kermorgant

zonuexe avatar Apr 17 '18 06:04 zonuexe

Update. #3

zonuexe avatar Apr 17 '18 13:04 zonuexe

Update https://github.com/emacs-php/phpactor.el/pull/10

zonuexe avatar Apr 20 '18 17:04 zonuexe

Update #16

zonuexe avatar Apr 30 '18 04:04 zonuexe

Update #17

zonuexe avatar Apr 30 '18 08:04 zonuexe

I'm currently trying to implement context_menu here, however, I'm struggling a lot since it seems to be the case that the function phpactor-action-input-callback is using the wrong callback (this is changed in my branch), and also often provides invalid arguments to the RPC (I believe this is PHPActor's fault, though).

For example: calling M-x phpactor-context-menu on Book.php L18C24, choosing rename_variable, in my branch causes the error: user-error: Invalid arguments "current_path" for handler "rename_variable", valid arguments: "path", "source", "offset", "name", "name_suggestion", "scope"

:current_path doesn't seem to be any different to :path, so I'm not sure why phpactor sometimes specifies one instead of the other.

I've also encountered an issue where phpactor provided a parameter which was missing the key choices (when trying to rename variable), causing the function phpactor--action-input-parameters to throw an error.

I hope what I've said makes some kind of sense - I think the fixes will need to be on phpactor's end)

@dantleech any insight?

If I haven't been clear here, please let me know and I can try to clarify.

MarTango avatar May 23 '18 18:05 MarTango

current_path is what the context menu needs, however this is mapped to path by Phpactor (you may also be interested in the Handler which will progressively ask for missing information via. RPC callbacks).

What would help is if you had the request and response, if you don't know already this can be easily found by adding the following in a Phpactor config file (e.g. $HOME/.config/phpactor/phpactor.yml`)

rpc.store_replay: true

You can then easily debug the last RPC command sent to Phpactor with:

$ phpactor rpc --replay --verbose

and see the exact request and response.

Let me know if you have any other questions, I'm having a look at getting Emacs running on my side, so might be able to help out.

dantleech avatar May 23 '18 20:05 dantleech

Update #22, Implemented context menu action. (Thanks @dantleech )

And phpactor package is now available on MELPA and MELPA stable.

zonuexe avatar May 26 '18 17:05 zonuexe

Update #34, Implemented import_class action. (Thanks @kermorgant, and I invited him as a member of @emacs-php/developers)

zonuexe avatar Jul 26 '18 03:07 zonuexe