如何让 VSCode 主题识别 C# 接口? [英] How can I make a VSCode theme recognize C# interfaces?

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

问题描述

我正在尝试为 Visual Studio Code 制作一个符合我要求的主题.目前,我正在尝试使用 Obsidian 处理 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".

为此,尝试 CTRL-Shift-P 并输入范围:选择

For that, try CTRL-Shift-P and type scope: choose

Developer: Inspect TM Scopes  

无论选择哪个关键字,例如interface,您都会获得其 textmate 范围的列表.这应该作为上面的范围值插入.[根据我的经验,打开Inspect TM Scopes"面板,然后单击几个项目,然后单击您想要的界面这样的项目会更准确- 示波器面板将保持打开状态.] 您可以从示波器面板复制.

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# 接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆