yaegassy / coc-intelephense

intelephense (PHP language server) extension for coc.nvim. intelephense’s various LSP features and this extension's additional features are available.
https://www.npmjs.com/package/@yaegassy/coc-intelephense
MIT License
98 stars 4 forks source link

feat: getterSetter code action #33

Closed yaegassy closed 2 years ago

yaegassy commented 2 years ago

Description

Added code action to quickly generate getters and setters. it feature intelligently implemented using php-parser.

If a similar feature is added in the upstream in the future, this feature, which was added independently by coc-intelephense, will of course be removed.

Misc

The VSCode community seems to have a number of dedicated extensions for getterSetter.

yaegassy commented 2 years ago

DEMO (mp4)

Insert PHP Getter

Works with <Plug>(coc-codeaction-line) and <Plug>(coc-codeaction-selected)

Example key mapping:

nmap <silent> ga <Plug>(coc-codeaction-line)
xmap <silent> ga <Plug>(coc-codeaction-selected)

https://user-images.githubusercontent.com/188642/170917110-71e06f1c-9cb6-420e-ac71-90b81cdb7075.mp4

yaegassy commented 2 years ago

DEMO (mp4)

Insert PHP Setter

Works with <Plug>(coc-codeaction-line) and <Plug>(coc-codeaction-selected)

Example key mapping:

nmap <silent> ga <Plug>(coc-codeaction-line)
xmap <silent> ga <Plug>(coc-codeaction-selected)

https://user-images.githubusercontent.com/188642/170917237-5918ac0e-16ab-4d76-a814-199905b8ccdd.mp4

yaegassy commented 2 years ago

DEMO (mp4)

Insert PHP Getter & Setter

Works with <Plug>(coc-codeaction-line) and <Plug>(coc-codeaction-selected)

Example key mapping:

nmap <silent> ga <Plug>(coc-codeaction-line)
xmap <silent> ga <Plug>(coc-codeaction-selected)

https://user-images.githubusercontent.com/188642/170917346-040fe2fe-81c2-4120-8286-b8f246a692f8.mp4