简体   繁体   English

tmLanguage中的注释行以。*开头。TextMate语法语法高亮

[英]Comment Line in tmLanguage starts with .* TextMate Grammar Syntax Highlight

I am working on my own Syntax Highlighting extension for VS code and I have comment lines that start with ".*" which I want to highlight. 我正在为VS代码开发自己的“语法突出显示”扩展程序,并且注释行以“。*”开头要突出显示。

For code I have: 对于代码,我有:

"comment": {
    "patterns": [{
        "name": "comment.line.as",
        "match":  "(\.\*).*$\n?",
        "captures": {
            '1': {
                "name": "punctuation.definition.comment.as"
            }
        }
    }]
}

But this does not seems to add the correct comment scope to my lines that begin with .*. 但这似乎并未为以。*开头的行添加正确的注释范围。

Thank you for your help. 谢谢您的帮助。

Simple mistake, since this is in a .json file and the regex is in between quotes I have to escape the escape characters. 一个简单的错误,因为它位于.json文件中,而正则表达式位于引号之间,所以我必须对转义符进行转义。 . become \\. 成为\\。 * become \\* etc... *变成\\ *等...

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

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