0

I have installed phpcs vscode extension and configured vscode settings as follows:

settings.json:

...
"php.suggest.basic": true,
"php.validate.executablePath": "/usr/bin/php",
"php.validate.run": "onSave",
"phpcs.enable": true,
"phpcs.executablePath": "/usr/bin/phpcs",
"phpcs.standard": "WordPress"
...

Also phpcs --config-show displays the below include paths for WordPress Code Style Standard:

> phpcs --config-show
Using config file: /home/iarnous/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.conf

installed_paths: /home/iarnous/wp-standard,/home/iarnous/php-compatibility

Also I have validation run onSave.

My Question: How do I configure vscode to auto-format/auto-fix php files using WordPress-Core Standard?

Best regards,

xiarnousx
  • 575
  • 6
  • 18

1 Answers1

0

I have added phpcbf extension and globally via composer installed the package. Afterwords I opened vscode settings and added the below entry to the main json file:

"phpcbf.enable": true,
"phpcbf.executablePath": "/usr/bin/phpcbf",
"phpcbf.documentFormattingProvider": true,
"phpcbf.onsave": true,
"phpcbf.debug": true,
"phpcbf.standard": "WordPress"
xiarnousx
  • 575
  • 6
  • 18