简体   繁体   English

我的主题用来突出显示此语法的属性的名称是什么?

[英]What is the name of the property that is used by my theme to highlight this syntax?

I would like to change the color highlighting of the text in the image that I have posted below, however;但是,我想更改我在下面发布的图像中文本的颜色突出显示; I cannot find the name of the token/property that is responsible for its foreground color.我找不到负责其前景色的令牌/属性的名称。 When I place my caret in the string, the text is highlighted.当我将插入符号放在字符串中时,文本会突出显示。

Currently the theme I am using is a VSCode theme: Material Palenight High Contrast.目前我使用的主题是 VSCode 主题:Material Palenight High Contrast。

截屏

VS-Code's Scope Inspector Tool: VS-Code 的 Scope 检查器工具:

So there are two things you need to do to attempt to get VSCode to highlight as you would like.因此,您需要做两件事来尝试让 VSCode 按您的意愿突出显示。 First you need to make sure that an extension you installed isn't dynamicly highlighting your text.首先,您需要确保您安装的扩展程序没有动态突出显示您的文本。 To do that you need to turn off all your extension.为此,您需要关闭所有扩展程序。 After your extension are turned off check if the highlighting is adjusted the way you like.关闭扩展程序后,检查突出显示是否按照您喜欢的方式调整。 If it is, then you can turn your extension back on, one by one, testing each one, until you find the one responsible for the highlighting.如果是,那么您可以重新打开您的扩展程序,一个一个地测试每个,直到您找到负责突出显示的那个。 The other thing you need to do is get the name of the property via VSCode tools, and change the highlighting of your syntax accordingly您需要做的另一件事是通过 VSCode 工具获取属性的名称,并相应地更改语法的突出显示

To get the name of any property you can use the Scope Inspector tool that comes with VSCode out of the box.要获取任何属性的名称,您可以使用 VSCode 开箱即用的 Scope Inspector 工具。 Below is a screen shot of what it looks like.下面是它的外观截图。



VSC-Scope-Inspector-工具




How to use the Scope-Inspector-Tool:如何使用 Scope-Inspector-Tool:

  • First press F1 to open up the commands menu as shown in the photo.首先按 F1 打开命令菜单,如图所示。

  • After the menu drops open from the top of the editor type菜单从编辑器类型的顶部打开后

Inspect Editor Tokens and Scopes检查编辑器标记和范围

  • After typing the above words into the commands menu it should be the first option.在命令菜单中输入上述单词后,它应该是第一个选项。 Click it to open it.单击它以打开它。

  • To close it you can press escape, or instead of closing it, after you open it, you can move the position of your cursor within the editor to see the scopes of other properties.要关闭它,您可以按退出,或者打开它后,您可以在编辑器中移动 cursor 的 position 以查看其他属性的范围,而不是关闭它。

  • In order to get the property you desire you need to make sure the cursor is to the left of one of the characters that belongs to the syntax that you want to inspect, or learn the property name of.为了获得您想要的属性,您需要确保 cursor 位于属于您要检查或了解其属性名称的语法的字符之一的左侧。

Side Note: This tool only works inside of the editor for syntax highlighting that is provided by your current theme.旁注:此工具仅适用于编辑器内部,用于当前主题提供的语法突出显示。 The only exception to this is if your properties are being overridden by an extension, or you currently have them altered in your local, or global vscode '/settings.json' files.唯一的例外是,如果您的属性被扩展覆盖,或者您当前在本地或全局 vscode '/settings.json' 文件中更改了它们。

After you get the name of the property you need to adjust your theme in the VSCode settings.json file.获得属性名称后,您需要在 VSCode settings.json 文件中调整主题。 I suggest changing it in the local settings rather than global using the filepath:我建议使用文件路径在本地设置而不是全局设置中更改它:

./.vscode/settings.json

once in you have your settings open use the setting bellow to configure your syntaxes highlighting.一旦你打开你的设置,使用下面的设置来配置你的语法突出显示。


  "tokenColors": [
    {
      "scope": "string", // Enter the syntax-token-scope here
      "settings": {
        "foreground": "#FFBBBB", // Set the text-color here
        "fontStyle": "bold" // set the text style here
      }
    }

    // For changing other syntax just keep adding blocks
   ]

Tip: The properties are actually TextMate token scopes.提示:这些属性实际上是 TextMate 令牌范围。

For more help on learning the name of token scopes (Syntax Highlighting Properties) you can visit VSCodes official page at the Link Below.有关学习令牌范围名称(语法突出显示属性)的更多帮助,您可以在下面的链接中访问 VSCodes 官方页面。

VSCode on Syntax Highlighting <- Great Resource! VSCode 上的语法高亮<- 很棒的资源!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM