This assumes you're editing a WordPress theme which is the root of your VSCode workspace. In other words if your theme lived in /wp-content/themes/my-awesome-theme
. You would drag the directory my-awesome-theme
into VSCode and start editing files from there. This also assumes you're using Composer.
If this doesn't work for you check out https://www.edmundcwm.com/setting-up-wordpress-coding-standards-in-vs-code/ which details installing the PHP Code Sniffer tools globally instead of in a project.
We need to require dependencies in our project.
composer require --dev squizlabs/php_codesniffer
composer require --dev dealerdirect/phpcodesniffer-composer-installer
composer require --dev wp-coding-standards/wpcs