Closed dukevin closed 6 years ago
@dukevin Please update to 1.0.0 and check whether your issue persists.
FWIW, I updated to 1.0.0 and still had this issue. However I was able to use the new "phpcs.executablePath" user setting and specify my global composer installed phpcs' path and things are working great.
I can confirm the error after updating VSCode to 1.20.1 on windows 10 trying to use the extension with phpcs installed via composer locally to my project.
I'm betting this has to do with the part of the extension which tries to automatically locate phpcs from composer.json, Wish I was a bit more skilled to dive deeper though - I dunno much about extension bug checking.
The suggestion by @briantully is a good workaround. This is what that looks like for phpcs installed via composer in my project:
"phpcs.executablePath": "vendor/squizlabs/php_codesniffer/bin/phpcs",
Can also confirm this error on latest VSCode on Windows 7.
Everything was working fine yesterday, then today I came into work, ran composer update
, and boom, same error as the screenshot in OP's post. I've since just disabled the extension entirely because even with a global installation, phpcs begins throwing errors.
I have managed to reproduce this issue and I am working on a fix
I just published 1.0.4 with a fix for this issue. Let me explain a bit:
The fix was on the composer path resolver and should work properly now.
Having a phpcs.executablePath
set at any settings scope (user/workspace/folder) will bypass both composer and global phpcs path resolvers. This has better performance since paths are not searched to find the executable (even though they are cached for subsequent linting).
When no phpcs.executablePath
is set then a search for the executable is performed in the following order:
If both fail then this message occurs. So if you don't have phpcs installed in your project via composer then you must have it accessible via your system's PATH.
I have removed the phpcs.executablePath
setting and can confirm the fix is working for VSCode to 1.20.1 on Windows 10 with phpcs installed in my project via composer.
Thanks for the super fast turnaround @ikappas
For the record, I'm going to replace and continue to use a phpcs.executablePath
value due to your remark about performance so thanks for that as well.
@jerturowetz Great to hear you got your issue resolved. Closing this and fixed.
Thanks @ikappas!
@dukevan I’m assuming you’re up and running again?
Yes, I got it working through about a day of moving files around and playing with configs. I'm on phpcs v1.0.4. Also is it necessary to have composer to use phpcs? I could not get it to work with anything else including pear
It's not strictly necessary but I think many would recommend it. Composer is the preferred (only?) package manager for php and can help you out no matter what you get up to in the language.
This has definitely got to be a bug, I've installed composer, pear, phpcs, the plugin and it still says this error. Googling shows a bunch of other people have this issue.