Closed Vagr9K closed 7 years ago
Hey @Vagr9K,
We did a quick check and this issue looks very darn similar to
This could be a coincidence, but if any of these issues solves your problem then I did a good job :smile:
If not, the maintainers will get to this issue shortly.
Cheers, Your Friendly Neighborhood ProBot
Sorry bot, but you failed miserably.
I experienced the same issue when I today was working on a project that has a phpcs.xml file as part of the project.
I found out that I can add the missing rulesets by calling the version of phpcs that is embedded in the extension with the --config-set
parameter (your paths both to the extension and the config file will probably be different):
$HOME/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/vendor/squizlabs/php_codesniffer/bin/phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
Unfortunately, this only causes another error to appear. In Visual Studio Code, the following error now appears:
[Info - 23:34:46] Connection to server got closed. Server will restart.
[Error - 23:34:46] Request textDocument/formatting failed.
Error: Connection got disposed.
at Object.dispose (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-jsonrpc/lib/main.js:816:25)
at Object.dispose (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-languageclient/lib/client.js:66:35)
at LanguageClient.handleConnectionClosed (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-languageclient/lib/client.js:1071:38)
at LanguageClient.handleConnectionClosed (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-languageclient/lib/main.js:86:15)
at closeHandler (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-languageclient/lib/client.js:1059:18)
at CallbackList.invoke (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-jsonrpc/lib/events.js:114:39)
at Emitter.fire (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-jsonrpc/lib/events.js:178:36)
at closeHandler (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-jsonrpc/lib/main.js:212:26)
at CallbackList.invoke (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-jsonrpc/lib/events.js:114:39)
at Emitter.fire (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-jsonrpc/lib/events.js:178:36)
at StreamMessageWriter.AbstractMessageWriter.fireClose (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-jsonrpc/lib/messageWriter.js:48:27)
at Socket.<anonymous> (/Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/node_modules/vscode-jsonrpc/lib/messageWriter.js:70:63)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at Pipe._handle.close [as _onclose] (net.js:510:12)
But if I run $HOME/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/vendor/squizlabs/php_codesniffer/bin/phpcs
from the terminal, it gives me the following error:
PHP Fatal error: Class 'WordPress\AbstractArrayAssignmentRestrictionsSniff' not found in /Users/Kim/.composer/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayAssignmentRestrictionsSniff.php on line 30
PHP Stack trace:
PHP 1. {main}() /Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/vendor/squizlabs/php_codesniffer/bin/phpcs:0
PHP 2. PHP_CodeSniffer\Runner->runPHPCS() /Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/vendor/squizlabs/php_codesniffer/bin/phpcs:18
PHP 3. PHP_CodeSniffer\Runner->init() /Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/vendor/squizlabs/php_codesniffer/src/Runner.php:67
PHP 4. PHP_CodeSniffer\Ruleset->__construct() /Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/vendor/squizlabs/php_codesniffer/src/Runner.php:272
PHP 5. PHP_CodeSniffer\Ruleset->registerSniffs() /Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/vendor/squizlabs/php_codesniffer/src/Ruleset.php:197
PHP 6. PHP_CodeSniffer\Autoload::loadFile() /Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/vendor/squizlabs/php_codesniffer/src/Ruleset.php:1042
PHP 7. include() /Users/Kim/.vscode/extensions/felixfbecker.php-intellisense-1.5.1/vendor/squizlabs/php_codesniffer/autoload.php:134
I speculate that this might happen because the current builtin version of phpcs in the extension is 3.0.0RC3 (beta), while the wp-coding-standards page state v3.0.2 as the minimum version of phpcs.
First of all, thanks for the great extension!
I'm trying to setup formatting for the Wordpress codebase.
wp-coding-standards/wpcs
andphpcs
are installed globally.Output of
phpcs --config-show
:phpcs -i
:My
phpcs.xml.dist
:phpcs -e
:Error inside VSCode:
NOTE: I can bypass the missing standard error by using the full path in
phpcs.xml.dist
:But the extension still fails:
Or when using
WordPress-Core
instead ofWordpress
: