【问题标题】:PHPCS setup in Visual studio codeVisual Studio 代码中的 PHPCS 设置
【发布时间】:2019-02-03 20:13:55
【问题描述】:

我想在 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。谁能建议我怎么做?

【问题讨论】:

    标签: php visual-studio-code vscode-settings phpcs


    【解决方案1】:

    终于,我得到了答案。首先,我在 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
    }
    

    设置后一切正常。

    【讨论】:

      猜你喜欢
      • 2018-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-17
      • 1970-01-01
      • 2020-07-11
      相关资源
      最近更新 更多