提问人:Mis 提问时间:5/13/2023 最后编辑:starballMis 更新时间:5/13/2023 访问量:134
如何为 VS Code 语言扩展的注释中的括号定义括号对颜色?
How can I define bracket pair colorization for brackets inside comments for a VS Code language extension?
问:
我正在为一种语言制作 TextMate 语法以获得语法突出显示。这是文档注释中标签的规则:@link
"scopeName": "source.amx.pawn",
"patterns": [
{
"name": "comment.block.documentation.amx.pawn",
"begin": "/\\*\\*(?!/)",
"end": "\\*/",
"patterns": [{ "include": "#docblock" }]
},
// more patterns...
],
"repository": {
"docblock": {
"patterns": [
"match": "({)(@)(link|linkcode|linkplain)\\s+(\\w+)\\s+(.*)(})",
"captures": {
"1": { "name": "punctuation.definition.bracket.amx.pawn" },
"2": { "name": "punctuation.docblock.at.amx.pawn" },
"3": { "name": "storage.type.class.docblock.tag.amx.pawn" },
"4": { "name": "variable.other.docblock.link.amx.pawn" },
"5": { "name": "entity.name.type.instance.docblock.amx.pawn" },
"6": { "name": "punctuation.definition.bracket.amx.pawn" },
}
]
},
// more stuff...
}
}
除了大括号外,所有内容都正确着色。它们具有标点符号颜色(这是我在规则中指定的颜色)。
但我认为 vscode 无论如何都会在其上应用括号对着色器,例如,就像在打字稿上一样。
如您所见,在打字稿中,它应用了括号对着色。
如果我检查编辑器标记和范围,这些是带有语法的大括号的 textmate 范围:
punctuation.definition.bracket.amx.pawn
comment.block.documentation.amx.pawn
source.amx.pawn
这些是 TypeScript 中大括号的作用域:
punctuation.definition.bracket.curly.end.jsdoc
entity.name.type.instance.jsdoc
comment.block.documentation.ts
source.ts
唯一的区别是范围,但我认为这是前一个令牌的尾随范围,所以我猜括号对着色器并不关心这些范围。entity.name.type.instance
我怎样才能获得与打字稿语法相同的结果?
答: 暂无答案
评论
/**\n * {{{@link something something}}}\n */