marlonfan / coc-phpls

šŸ­ php language server for coc.nvim
MIT License
212 stars 16 forks source link

Configurable auto phpdoc creation #38

Closed elle-the-dev closed 4 years ago

elle-the-dev commented 4 years ago

A feature of intelephense is "Configurable auto phpdoc creation that infers return types and identifies thrown exceptions." Is there a way to call this via coc.nvim?

AlexandreHagen commented 4 years ago

https://github.com/neoclide/coc.nvim/issues/590#issuecomment-478105861

elle-the-dev commented 4 years ago

That is just talking about autocompletion. "auto phpdoc creation" is about generating phpdoc blocks for methods, with things like @throws for any exceptions that are unhandled.

AlexandreHagen commented 4 years ago

You right. I also looked for any code about Phpdoc in coc-phpls. I found nothing. So isnā€™t currently support I guess. Now the only solution is to implement it ourselves.

tofulm commented 4 years ago

there is : https://github.com/kkoomen/vim-doge

AlexandreHagen commented 4 years ago

Thanks @tofulm I didnā€™t know it.

yaegassy commented 4 years ago

@derekhamilton

In the current version of "intelephense", the generation of phpdocs is possible from code actions.

It is available in coc-phpls using the CodeAction feature. <Plug>(coc-codeaction)

You will need to purchase an intelephense license and have it set to intelephense.licenceKey.

Ref: https://github.com/bmewburn/vscode-intelephense/commit/c4423153254acf5267df9bd6508c7f44e4995902

Demo(Vim8)

I tried DEMO with vim8, but there is a slight difference in the display on nvim.

If you want to check the atmosphere of the display in nvim, please refer to this issue. https://github.com/marlonfan/coc-phpls/issues/68#issuecomment-657881618

coc-phpls-gen-phpdoc

elle-the-dev commented 4 years ago

Thank you! For any other onlookers, if intelephense is not up-to-date, you'll get an error coc.nvim: CodeAction not found when calling <Plug>coc-codeaction.