Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex VSCode:用户设置中的TextMate正则表达式_Regex_Design Patterns_Visual Studio Code_Formatting_Textmate - Fatal编程技术网

Regex VSCode:用户设置中的TextMate正则表达式

Regex VSCode:用户设置中的TextMate正则表达式,regex,design-patterns,visual-studio-code,formatting,textmate,Regex,Design Patterns,Visual Studio Code,Formatting,Textmate,我正试图改变一个主题,使之更适合我的日常使用,但我在尝试自定义一个特定的单词或模式时遇到了一些困难 我现在正在使用这种格式 "editor.tokenColorCustomizations": { "textMateRules": [ { "scope": "comment", "settings": { "foreground": "#ff0000", }

我正试图改变一个主题,使之更适合我的日常使用,但我在尝试自定义一个特定的单词或模式时遇到了一些困难

我现在正在使用这种格式

"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "comment",
            "settings": {
                "foreground": "#ff0000",
            }
        },
    ]
}

是否可以格式化特定的关键字或模式而不是作用域?

要将语法高亮显示应用于特定的关键字和其他语言构造,您需要编写一个带有语法的扩展来解析该语言的语法。当您编写这样的扩展时,您还定义了每个语言构造的作用域

例如,在语言支持扩展中,我可能会匹配关键字
function
,并为其指定范围
entity.name.function

<key>FunctionKeyword</key>
<dict>
    <key>match</key>
    <string>function</string>
    <key>name</key>
    <string>entity.name.function</string>
</dict>
FunctionKeyword
比赛
功能
名称
entity.name.function
作为最终用户,您可以覆盖主题对范围着色的方式,但无法更改语言支持将范围分配给语言构造的方式

TL;医生:不,你不能