我从https://github.com/FriendsOfPHP/PHP-CS-Fixer下载并安装了PHP VSCode扩展(由junstyle提供)和官方的php- CS - Fixer -v2.phar文件。我创建了一个名为config.php-cs的文件,并将参考配置代码粘贴到其中:
return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
'array_indentation' => true,
....我把这两个文件都放在C:\wamp64\www\configuration_php\里了
这是我的settings.json
{
"workbench.iconTheme": "file-icons",
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"editor.formatOnPaste": true,
"workbench.colorTheme": "One Dark Pro",
"editor.fontLigatures": true,
"editor.lineHeight": 22,
"files.trimTrailingWhitespace": true,
"editor.fontWeight": "400",
"editor.renderWhitespace": "all",
"editor.tabSize": 2,
"editor.cursorStyle": "line",
"editor.insertSpaces": false,
"prettier.useTabs": true,
"terminal.integrated.fontSize": 15,
"javascript.validate.enable": false,
"editor.formatOnSave": true,
"files.autoSave": "off",
"window.zoomLevel": 0,
"editor.fontFamily": "JetBrains Mono, Consolas, 'Courier New', monospace",
"editor.cursorBlinking": "smooth",
"editor.formatOnSaveTimeout": 5000,
"php-cs-fixer.executablePath": "C:\\wamp64\\www\\configuration_php\\php-cs-fixer-v2.phar",
"php-cs-fixer.config": "C:\\wamp64\\www\\configuration_php\\config.php_cs",
"php-cs-fixer.onsave": true,
}我可以告诉我的编辑器考虑executablePath,因为如果我在路径中放了一个错误,我会得到一个错误消息。问题出在配置路径上。VSCode似乎完全忽略了它,不会使用配置文件,如果我在路径或文件内容中引入错误,也不会引发任何错误。
我是不是漏掉了什么?
发布于 2020-01-26 17:59:16
对不起,伙计们,我是个土豆,我写了"php-cs“而不是"php_cs”。关着的不营业的。
https://stackoverflow.com/questions/59914126
复制相似问题