Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access other phpactor features? #25

Closed
lukepass opened this issue May 17, 2022 · 7 comments
Closed

How to access other phpactor features? #25

lukepass opened this issue May 17, 2022 · 7 comments

Comments

@lukepass
Copy link

Hello and thanks for the good work! Is there a way to access the more advanced phpactor features such as transform, context menu etc...?

I mapped these commands:

<Plug>(coc-codeaction-cursor)
<Plug>(coc-codeaction-selected)
<Plug>(coc-refactor)

But I would like to get the menu such as in "standard" phpactor:

image

Which <Plug>(coc-XYZ) should I map?

Thanks!

@dantleech
Copy link
Contributor

dantleech commented May 17, 2022

All of those transformations are available as standard code actions.

But nothing wrong with using the "standard" Phpactor with VIM - I do this to fill in the missing gaps: https://phpactor.readthedocs.io/en/master/usage/vim-plugin.html

FWIW the only things I use the "standard" plugin for now are:

  • Extracting constants and extracting methods (because VIM can prompt you the name, and LSP cannot as of today)
  • Renaming and moving classes (because it works better than the LSP version)

@lukepass
Copy link
Author

lukepass commented May 17, 2022 via email

@dantleech
Copy link
Contributor

when i used CoC I had:

nmap <Leader>ca <Plug>(coc-codeaction)
xmap <Leader>ca <Plug>(coc-codeaction-selected)

you just need to invoke this anywhere in the document, if one of the transformations can be applied it will offer you that option.

@lukepass
Copy link
Author

Yes, I have the same mappings but unfortunately most of the phpactor best features (namely "import all", "transform", "complete constructor" etc...) don't appear in the menu:

image

@dantleech
Copy link
Contributor

many of the "transforms" are now code actions which are shown if they are possible (e.g. complete constructor will show if you have a constructor with no properties or parameter assignments). some exceptions include "generate interface" which is still not supported as a code action.

Import all should show as a code action.

closing for now, but feel free to carry on the discussion

@lukepass
Copy link
Author

Thank you @dantleech ! Now it's a lot better!

This is the "classic" menu:

image

These are the new menus:

image

image

It seems that the appropriate context-menu appears only when needed, which is even better!

@dantleech
Copy link
Contributor

awsome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants