在 vs 代码中更改错误突出显示颜色 [英] Change error highlight color in vs code
问题描述
我构建了一个项目并在问题视图"中遇到了一些问题,我单击问题以查看突出显示该问题的一行代码.
I build a project and get some problems in the "Problems view", I click on the problem to see a line of code with that problem highlighted.
它确实得到了突出显示.然而,如果使用深色风格的主题,至少对我来说,高亮真的很难被注意到(第 23 行被高亮显示):
And it gets highlighted indeed. However, if dark-styled theme is used, highlight is, for me at least, really hard to notice (line 23 is highlighted):
我想这种颜色不能简单地在某处进行硬编码,因为它在例如红色主题和浅色主题中是不同的:
I guess this color can't be simply hard-coded somewhere since it's different in, for example, red theme and light-styled themes:
有没有办法改变这种颜色?
Is there a way to change this color?
UPD:这个问题不是更改错误"的重复风格";错误样式(波浪线)同时适用于所有错误,我的问题是仅突出显示选定的错误.
UPD: This question is not a duplicate of "change the error style"; error style (squiggle) applies to all errors at once, my question is about highlighting only the selected error.
推荐答案
显然,您实际上可以在不使用扩展的情况下更改它.我创建了一个 issue 并得到了这个颜色被称为 editor.rangeHighlightBackground 的答案
并且您可以通过以下方式在您的用户设置 (settings.json
) 中覆盖它:
Apparently, you can actually change it without using an extension. I created an issue and got the answer that this color is called editor.rangeHighlightBackground
and you can override it in your User Settings (settings.json
) by:
{
"workbench.colorCustomizations": {
"editor.rangeHighlightBackground": "#00AA00"
}
}
要打开用户设置,只需在 Mac 上使用 Cmd+,
或在 Windows 上使用 Ctrl+,
To open User Settings just use Cmd+,
on mac or Ctrl+,
on windows
这篇关于在 vs 代码中更改错误突出显示颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!