为什么VS Code在下划线之间突出显示语法

huangapple go评论57阅读模式
英文:

Why is VS Code highlighting syntax between underscores

问题

我是一个相对新手使用VS Code,已经喜欢上了许多功能。然而,有一件事情一直很让我分心,那就是在下划线之间的任何文本都会自动显示为粗体的白色文字。这个问题似乎在任何暗色主题下都会出现(但在浅色主题下则不会)。下面,您可以看到两个变量(image_idnum_in_group)在下划线之间创建了白色文字,我的代码中也是如此。

为什么VS Code在下划线之间突出显示语法

在这里,您可以看到image_id的令牌标识是正确的,这意味着白色文字与标记化无关。

为什么VS Code在下划线之间突出显示语法

我不知道这个问题是什么时候开始的,因此我不知道它是否始于特定的扩展或设置更改,或者它是否一直存在。我更喜欢暗色主题,因为对我的眼睛更友好,而且我无法避免在我的代码中使用下划线(例如,许多R的tidyverse函数使用下划线)。我使用的是运行在MacOS上的VS Code 1.78.2,主要用于Python和R。我应该在哪里查找解决这个问题的方法?

我尝试过多种语言,问题在Python、R和C++中都存在(我还没有测试其他语言)。我还测试了多个暗色主题,它们都有相同的问题。高对比度主题也是如此,但似乎浅色主题没有这个问题。

英文:

I fairly new to VS Code and there are many features that I already love. One thing that has been very distracting, however, is that any text between underscores is automatically highlighted as bold, white text. The issue seems to occur with any dark theme (but not light themes). Below, you can see the issue where two variables (image_id and num_in_group) create white text in between the underscores, and the same is true throughout my code.

为什么VS Code在下划线之间突出显示语法

Here you can see that the token identification of image_id is correct, meaning the white text does not relate to tokenization.

为什么VS Code在下划线之间突出显示语法

I don't know when the issue started, and therefore I have no idea if it started with a particular extension or setting change I made, or if it's always been there. I prefer dark themes as they are easier on my eyes, and I can't get away from using underscores in my code (e.g., many R tidyverse functions use underscores). I'm on MacOS running VS Code 1.78.2, and using it mostly for python and R. Where should I look to fix this issue?

I've tried multiple languages and the issue holds for python, R, and C++ (I haven't tested others). I've also tested numerous dark themes, and they all have the same issue. The same is true for high contrast themes, but does not seem to be an issue for light themes.

答案1

得分: 2

我在安装了VSCode扩展程序'R Markdown All in One'(TianyiShi.rmarkdown)v0.0.14后遇到了相同的问题。禁用该扩展程序解决了语法高亮问题。

编辑以补充:这在问题#21:下划线破坏了代码高亮显示中有记录。

英文:

I had this same problem after installing VSCode extension 'R Markdown All in One' (TianyiShi.rmarkdown) v0.0.14. Disabling the extension fixed the syntax highlighting issue.

Edit to add: this is documented in Issue #21: Underscores mess up code highlighting

huangapple
  • 本文由 发表于 2023年6月8日 04:22:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76426865.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定