【问题标题】:PHP CS Fixer won't load .php-cs file in Visual Studio CodePHP CS Fixer 不会在 Visual Studio Code 中加载 .php-cs 文件
【发布时间】:2020-01-25 22:56:52
【问题描述】:

我从https://github.com/FriendsOfPHP/PHP-CS-Fixer 下载并安装了 VSCode 的 PHP CS Fixer 扩展(由 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,
}

我可以告诉我的编辑器考虑可执行路径,因为如果我在路径中输入错误,我会收到一条错误消息。问题出在配置路径上。 VSCode 似乎完全忽略了它,如果我在路径或文件内容中引入错误,则不会使用配置文件或引发任何错误。

我错过了什么吗?

【问题讨论】:

    标签: visual-studio php-cs-fixer


    【解决方案1】:

    对不起,我是个土豆,我写的是“php-cs”而不是“php_cs”。关闭。

    【讨论】:

    • 不客气?
    猜你喜欢
    • 2018-02-11
    • 2019-07-22
    • 1970-01-01
    • 2017-06-25
    • 2019-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多