我正在为Visual Studio Code编写特定语言的扩展程序,到目前为止,我可以设置几个命令的颜色。
我的mylang.tmLanguage.json包含(简化)以下内容:
{
"\\$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "F-Script",
"patterns": [
{
"include": "#goto"
},
{
"include": "#strings"
}
],
"repository": {
"GOTO":
{
"patterns":
[{
"name": "support.function",
"match": "/(?!«)[a-zA-Z0-9_.\\-«»/(/)]{1,}(?=»)\\b"
},
{
"name": "support.function",
"match":"GOTO[(]{1}(# [a-zA-Z0-9_.-]{1,}|/)[)]{1}"
}]
},
"strings": {
"name": "string.quoted.double.f-script",
"begin": "\"|\\'",
"end": "\"|\\'",
"patterns": [
{
"name": "constant.character.escape.f-script",
"match": "$"
}
]
}
},
"scopeName": "source.f-script"
}
当我尝试测试“字符串”的颜色时,它会覆盖命令GOTO。
«GOTO(# THIS.COLOR.GOTO)»
"This Should be formated like a String"
"This Should be formated like a String «GOTO(# THIS.COLOR.GOTO)»"
我尝试做的是第3行的GOTO与第一行的颜色相同。我的问题是整条线的颜色都像一个字符串(包括GOTO命令)。
有没有人知道如何设置这个字符串格式化为字符串并且包含的命令颜色不同?
感谢名单
答案 0 :(得分:0)
您可以在goto
:
strings
"strings": {
"name": "string.quoted.double.f-script",
"begin": "\"|\\'",
"end": "\"|\\'",
"patterns": [
{
"name": "constant.character.escape.f-script",
"match": "$"
},
{
"include": "#goto"
}
]
}