VS代码:改变Lint的波浪线下划线颜色

时间:2017-08-08 22:11:46

标签: visual-studio-code vscode-settings

我的配置目前显示了与Typescript错误和TSLint警告相同的红色波浪线。

我对Visual Studio Code使用TSLint扩展名,但我认为配置是一般的VS Code配置。

这是应该的样子:

Image of what it should look like

我发现this feature request更进一步,而不仅仅是Squiggly线。

它不是" How to change error styles in VS Code"的副本。因为我只需要改变 Lint 警告的颜色。不是每一个错误。

4 个答案:

答案 0 :(得分:25)

有一个设置让tslint扩展名返回警告(绿色)而不是错误(红色):"tslint.alwaysShowRuleFailuresAsWarnings": true

此外,您可以更改tslint配置以确定哪些问题是错误,哪些是警告。

答案 1 :(得分:8)

Vscode v1.17增加了设置警告和信息颜色的功能:

Modify warning and info squiggles

"workbench.colorCustomizations": {
  "editorWarning.foreground": "#ff0",
  "editorInfo.foreground": "#00f"
}

答案 2 :(得分:2)

这将解决您的问题。

tslint.json 中添加"defaultSeverity": "warning"

参考:Change underline color to avoid confusion with compiler errors

答案 3 :(得分:0)

对于eslint,我能够为警告设置特定的规则,我认为这是一种更好的方法,而不是试图将所有内容都看成一个层次。未使用的var确实使我很烦,所以:

.eslintrc文件中...

{
    "rules" : {
    "no-unused-vars": "warn"
}