marlonfan / coc-phpls

🐭 php language server for coc.nvim
MIT License
212 stars 16 forks source link

Configure PHP warnings/errors #25

Closed robbash closed 5 years ago

robbash commented 5 years ago

Hi.

Not sure if I'm right here but I feel like I need to start somewhere: I installed this extension to enable coc for PHP files. Due to the nature of the project, there are a few unused private static properties in the classes. Is there a way, to configure what to warn or show errors about?

Thanks in advance, appreciate the effort you take.

marlonfan commented 5 years ago

This is a bug, I will check the cause and fix it as soon as possible

zlianon commented 5 years ago

@marlonfan This is not bug. For now, can't be reproduced.

@robbash Intelephense use own static analysis engine, and does not offer any option for solve your problem, for now. - Try this option, disable coc diagnostic, use ale or something else instead coc diagnostic, use PHPStan, allows you to configure, see https://github.com/phpstan/phpstan

Part of my coc-config

{ "coc.preferences.diagnostic.enable": false }

Part of my ale configuration

let g:ale_linters = {
    \ 'php': ['phpstan']
    \ }

Sorry for my bad English! I hope I helped :)

marlonfan commented 5 years ago

@mihaelartz I understand,in my opinion, that intelphine is an LSP, but it does not implement this aspect of the feature.

robbash commented 5 years ago

Thanks, @mihaelartz.

Have the diagnostics disabled now, so all these warnings that were annoying me disappeared. Haven't managed to get ale/phpstan running yet but will work on that.

zlianon commented 5 years ago

@robbash

  1. Install PHPStan with composer: composer global require --dev phpstan/phpstan
  2. If you want configure PHPStan, create new file in your project root with name phpstan.neon.dist and put your configuration in that file. (OPTIONAL)

And that's it :)

robbash commented 5 years ago

@mihaelartz thanks a lot. It's checking the files now. Cheers!

yaegassy commented 4 years ago

@marlonfan @robbash @m5ome

phpstan is now supported in coc-diagnostic.

https://github.com/iamcco/coc-diagnostic