问题描述
我正在使用Visual Studio Code用Flutter编码Dart.我安装了Dart和Flutter插件以及Matta Astorino的Material主题.问题是我无法使用材料主题海洋高对比度"颜色主题,使用Dart语言专门设置变量的语法突出显示.
I am using Visual Studio Code for coding Dart with Flutter. I installed Dart and Flutter plugins as well as the Material theme from Matta Astorino. The problem is I can't specifically set the syntax highlight of my variables with Dart language using the Material Theme Ocean High Contrast color theme.
我使用的设置:
"editor.tokenColorCustomizations": {
"[Material Theme Ocean High Contrast]": {
"comments": "#229977",
"variables": "#ffffff"
}
},
-Dart
从上图中,注释语法突出显示似乎可以正常工作,但变量的语法突出显示仍显示为灰色(应该是白色).
From the picture above, the comments syntax highlighting seems to work fine but the syntax highlighting for variables is still showing in grey (which supposed to be white).
-JavaScript
-JavaScript
在JavaScript中,它似乎可以正常工作.
In JavaScript, it seems to work fine.
请在VSCode的Dart语法突出显示方面有所帮助.
Please help on these Dart syntax highlighting for VSCode Thanks.
推荐答案
我不使用Dart,但是我可以说,有时您必须更加具体地设置语法范围颜色.
I don't use Dart, but i can say that, sometimes you have to be more specific with setting syntax scope colors.
首先-您需要知道范围是什么.为此,请运行检查TM范围.
First of all - you need to know what the scope is. To do this, please run Inspect TM Scopes.
在这里您已经介绍了如何执行此操作:
要更好地理解,请阅读:
- https://macromates.com/manual/en/language_grammars 12.4命名约定
- https://code.visualstudio.com/api/language -extensions/syntax-highlight-guide
- https://macromates.com/manual/en/language_grammars 12.4 Naming Conventions
- https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide
崇高文字也有很好的解释:
好,现在:
当您确定范围是什么时,则必须创建或覆盖它.示例:
When you find out what the scope is, then you have to create or overwrite it.Example:
"editor.tokenColorCustomizations": {
"[My Theme Name]": {
"textMateRules": [
{
"name": "Entity",
"scope": "entity.name",
"settings": {
"foreground": "#FFC66D"
}
},
]
}
},
如果您将创建越来越多的新范围,请记住:
- 过于具体会导致一种配色方案,通常只适合一种或两种语法.
这篇关于如何在Visual Studio Code中为Dart变量设置语法突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!