本文介绍了如何使VSCode主题识别C#接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使Visual Studio Code的主题能够按我想要的方式工作.目前,我正在尝试将黑曜石与C#规则一起使用,但是我不确定要使用哪个关键字来覆盖颜色自定义设置.VSCode似乎无法识别接口,因为它们是特定于语言的.

I am trying to get a theme for Visual Studio Code working to what I want. Currently, I'm trying to use Obsidian working with C# rules, but I'm not sure which key word to use to override color customizations. VSCode does not seem to recognize interfaces as they're language specific.

"editor.tokenColorCustomizations": {
        "functions" :{
            "foreground": "#F1F2F3"
        },
        "interface": { //not valid
            "foreground": "#B48C8C"
        }
    }

如何获得VSCode颜色自定义项以识别c#特定语法?

How can I get VSCode color customizations to recognize c# specific syntaxes?

推荐答案

editor.tokenColorCustomizations 可以使用多个值:注释,函数,关键字,数字,字符串,类型和变量.如果这些都不适合您 textMateRules .因此,您可以执行以下操作:

editor.tokenColorCustomizations can use a number of values: comments, functions, keywords, numbers, strings, types and variables. If none of those work for you textMateRules is available as well. So you can do something like:

"editor.tokenColorCustomizations": {
    "textMateRules": [{
        "scope": "yourScopeHere",
        "settings": {
            "fontStyle": "italic",
            "foreground": "#C69650"
        }
    }]
   },

因此,您只需要弄清楚"界面"需要什么范围.

So you just have to figure out what scope you need for "interface".

为此,请尝试--并键入scope:选择

For that, try -- and type scope: choose

Developer: Inspect TM Scopes

,以及选择了哪个关键字(例如 interface ),您都将获得其textmate范围的列表.应该将其作为上面的作用域值插入.[根据我的经验,打开"检查TM范围"面板,然后单击几个项目,然后单击想要的一个项目(如界面,会更准确.-合并范围面板将保持打开状态.]您可以从合并范围面板进行复制.

and for whichever keyword is selected, like interface you will get a listing of its textmate scope. That should be inserted as the scope value above. [In my experience, it is more accurate to open the "Inspect TM Scopes" panel and then click a couple of items and then the one, like interface, that you want - the scope panel will remain open.] You can copy from the scopes panel.

您可能只需要列出主要范围,但是如果需要缩小其范围,则可以在范围内包括逗号分隔列表中列出的其他范围:...,...,...

You may need only the main scope listed, but if need to narrow its scope you can include the others listed in a comma-separated list in the scopes: ..., ..., ...

这篇关于如何使VSCode主题识别C#接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 08:28