我正在处理一些遗留代码,并且 VScode 由于诸如 Line exceeds 85 characters, contains 91 characters
之类的警告而突出显示了很多行。 .这很烦人,我想将该限制提高到至少 120 个字符,甚至完全禁用它。
我的垂直标尺已经设置为 120。
如何移动或删除该限制?我到处找,但找不到有效的答案...这是我的项目 settings.json
{
"editor.wordWrapColumn": 120
}
最佳答案
在 VS Code 中编辑 phpcs 设置并确保“PHP Sniffer: Standard”为空白(以便它查找您的自定义规则集文件)。
在您的项目根目录中创建文件“phpcs.xml”,其中包含如下规则集:
<?xml version="1.0"?>
<ruleset name="MyRuleset">
<!-- Scan all files in directory -->
<file>.</file>
<!-- Ignore Composer dependencies -->
<exclude-pattern>vendor/</exclude-pattern>
<!-- Show colors in console -->
<arg value="-colors"/>
<!-- Show sniff codes in all reports -->
<arg value="ns"/>
<!-- Use PSR-12 as a base -->
<rule ref="PSR12"/>
<rule ref="Generic.Files.LineLength.TooLong">
<severity>0</severity>
</rule>
</ruleset>
关于visual-studio-code - 带有 VScode 的 phpcs - 如何禁用行长警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58769558/