fix(vscode-vipeye): 字符串转义引号导致 TextMate 作用域泄漏
字符串规则没有转义子规则,`'\''` / `"\""` 会被提前闭合:后续关键字 (如 or/def/return/pass)被渲染成字符串颜色。 - 新增 string-escape(constant.character.escape.viper)并让 4 条字符串规则 include - 单行字符串 end 由引号改为「引号或行尾」,即使写错也不会把作用域拖到下一行
This commit is contained in:
1 parent
d9559869e7
commit
91f668a033
1 file changed
+22
-2
@@ -78,6 +78,9 @@
|
||||
"begin": "\"\"\"",
|
||||
"end": "\"\"\"",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string-escape"
|
||||
},
|
||||
{
|
||||
"include": "#fstring-interpolation"
|
||||
}
|
||||
@@ -88,6 +91,9 @@
|
||||
"begin": "'''",
|
||||
"end": "'''",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string-escape"
|
||||
},
|
||||
{
|
||||
"include": "#fstring-interpolation"
|
||||
}
|
||||
@@ -96,8 +102,11 @@
|
||||
{
|
||||
"name": "string.quoted.double.viper",
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"end": "\"|$",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string-escape"
|
||||
},
|
||||
{
|
||||
"include": "#fstring-interpolation"
|
||||
}
|
||||
@@ -106,8 +115,11 @@
|
||||
{
|
||||
"name": "string.quoted.single.viper",
|
||||
"begin": "'",
|
||||
"end": "'",
|
||||
"end": "'|$",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string-escape"
|
||||
},
|
||||
{
|
||||
"include": "#fstring-interpolation"
|
||||
}
|
||||
@@ -115,6 +127,14 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"string-escape": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.viper",
|
||||
"match": "\\\\."
|
||||
}
|
||||
]
|
||||
},
|
||||
"fstring-interpolation": {
|
||||
"patterns": [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user