phpactor / coc-phpactor

Phpactor CoC Extension
https://github.com/phpactor/phpactor
MIT License
28 stars 3 forks source link

How to access other phpactor features? #25

Closed lukepass closed 2 years ago

lukepass commented 2 years ago

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 commented 2 years ago

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:

lukepass commented 2 years ago

Thanks for the quick answer! How can I access those code actions? How can I see the exact name to call in the mapping? Could you please make an example for "import all missing classes" and "generate constructor"?

Thanks a lot!

Il mar 17 mag 2022, 20:36 dantleech @.***> ha scritto:

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://github.com/phpactor/phpactor/issues/1184: https://phpactor.readthedocs.io/en/master/usage/vim-plugin.html

— Reply to this email directly, view it on GitHub https://github.com/phpactor/coc-phpactor/issues/25#issuecomment-1129193749, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRB2CIZ76M2EM4JGMRT3MDVKPRJNANCNFSM5WE7VWEQ . You are receiving this because you authored the thread.Message ID: @.***>

dantleech commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

awsome!