我想在VScode中添加phpcs CodeSniffer。我在Visual Studio中遇到错误phpcs: Request workspace/configuration failed with message: Unable to locate phpcs. Please add phpcs to your global path or use composer dependency manager to install it in your project locally.
。我也安装了PHPCS和PEAR。我在用户设置和工作区设置中尝试过的这些代码也在VScode中"phpcs.composerJsonPath": "C:/wamp/wpcs/composer.json"
。但是没有到达目的地,我应该如何设置路径?我的路径目录是C:\wamp\wpcs\phpcs
。谁能建议我该怎么做?
答案 0 :(得分:0)
最后,我得到了答案。首先,我在VScode中添加了扩展名phpcs和wpcs,然后在用户设置中添加了这些参数,以确保将PEAR和PHPCS,WPCS安装在本地目录中。
{
"phpcs.standard": "WordPress",
"phpcs.enable": true,
"php.validate.executablePath": "C:/wamp/bin/php/php5.6.25",
"phpcs.executablePath": "C:/wamp/bin/php/php5.6.25/phpcs.bat",
"phpcs.autoConfigSearch": true
}
设置完成后,现在一切正常。