我想为 VS 代码创建我的语法,扩展 TypeScript 之一。
这是我tmlanguage.json
用yo code
助手创建的:
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "mylang",
"patterns": [{
"include": "source.ts"
},
{
"include": "#keywords"
},
{
"include": "#strings"
},
{
"include": "#htmlTags"
}
],
"repository": {
"keywords": {
"patterns": [{
"name": "keyword.control.htmlscript",
"match": "\\b(if|while|for|return)\\b"
}]
},
"htmlTags": {
"patterns": [{
"name": "variable.language",
"match": "(div|text)"
}]
},
"strings": {
"name": "string.quoted.double.mylang",
"begin": "\"",
"end": "\"",
"patterns": [{
"name": "constant.character.escape.mylang",
"match": "\\\\."
}]
}
},
"scopeName": "source.mylang"
}
这个,没有"include": "source.ts"
很好的工作,我添加了这个包含来显示 TypeScript 语法。添加后,它只识别 TypeScript 代码,而不是我的。
为什么?有人做过类似的事情吗?