Skip to content

Commit 894c202

Browse files
committed
fix(scopes): Rewrite scope matching
1 parent 8d79d88 commit 894c202

9 files changed

Lines changed: 1200 additions & 2594 deletions

syntaxes/scopes.tmLanguage.json

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,69 @@
44
"name": "JSON Embedded TextMate Scopes",
55
"scopeName": "source.json.textmate.scopes",
66
"injectionSelector": [
7-
"L:source.json.embedded .meta.contributes. .meta.grammars. meta.structure.array.json meta.structure.dictionary.json meta.structure.dictionary.json support.type.property-name.json\n(.meta.embeddedLanguages. | .meta.tokenTypes.)\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.source -comment",
8-
"L:source.json.embedded .meta.contributes. .meta.grammars. meta.structure.array.json meta.structure.dictionary.json meta.structure.array.json\n(.meta.balancedBracketScopes. | .meta.unbalancedBracketScopes. | .meta.injectTo.)\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.source -comment",
9-
"L:source.json.embedded .meta.contributes. .meta.grammars. meta.structure.array.json .meta.scopeName. string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.source -comment",
10-
"L:source.json.embedded meta.structure.array.json .meta.t. string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.source -comment",
11-
"L:source.json.embedded meta.structure.array.json .meta.lines. meta.structure.array.json .meta.tokens. meta.structure.array.json .meta.scopes. meta.structure.array.json string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json meta.structure.array.json meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.source -comment",
12-
"L:source.json.embedded .meta.contributes. .meta.configurationDefaults. .meta.editor.tokenColorCustomizations. .meta.textMateRules. meta.structure.array.json .meta.scope. string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json meta.structure.array.json\n-.meta.scope. meta.structure.array.json meta.structure.array.json\n-meta.structure.array.json meta.structure.array.json .meta.scope.\n-meta.embedded.json.textmate.source -comment",
13-
"L:source.json.comments.embedded .meta.settings. .meta.editor.tokenColorCustomizations. .meta.textMateRules. meta.structure.array.json.comments .meta.scope. string.quoted.double.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.scope.\n-.meta.scope. meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.embedded.json.textmate.source -comment",
14-
"L:source.json.comments.embedded .meta.editor.tokenColorCustomizations. .meta.textMateRules. meta.structure.array.json.comments .meta.scope. string.quoted.double.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.scope.\n-.meta.scope. meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.embedded.json.textmate.source -comment",
15-
"L:source.json.comments.embedded .meta.tokenColors. meta.structure.array.json.comments .meta.scope. string.quoted.double.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.scope.\n-.meta.scope. meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.embedded.json.textmate.source -comment",
16-
"L:source.json.embedded .meta.tokenColors. meta.structure.array.json .meta.scope. string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json meta.structure.array.json\n-meta.structure.array.json meta.structure.array.json .meta.scope.\n-.meta.scope. meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.source -comment"
7+
"L:source.json.embedded .meta.contributes. .meta.grammars. meta.structure.array.json meta.structure.dictionary.json meta.structure.dictionary.json support.type.property-name.json\n(.meta.embeddedLanguages. | .meta.tokenTypes.)\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.scope -comment",
8+
"L:source.json.embedded .meta.contributes. .meta.grammars. meta.structure.array.json meta.structure.dictionary.json meta.structure.array.json\n(.meta.balancedBracketScopes. | .meta.unbalancedBracketScopes. | .meta.injectTo.)\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.scope -comment",
9+
"L:source.json.embedded .meta.contributes. .meta.grammars. meta.structure.array.json .meta.scopeName. string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.scope -comment",
10+
"L:source.json.embedded meta.structure.array.json .meta.t. string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.scope -comment",
11+
"L:source.json.embedded meta.structure.array.json .meta.lines. meta.structure.array.json .meta.tokens. meta.structure.array.json .meta.scopes. meta.structure.array.json string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json meta.structure.array.json meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.scope -comment",
12+
"L:source.json.embedded .meta.contributes. .meta.configurationDefaults. .meta.editor.tokenColorCustomizations. .meta.textMateRules. meta.structure.array.json .meta.scope. string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-.meta.textMateRules. meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json .meta.editor.tokenColorCustomizations.\n-meta.structure.array.json meta.structure.array.json meta.structure.array.json\n-.meta.scope. meta.structure.array.json meta.structure.array.json\n-meta.structure.array.json meta.structure.array.json .meta.scope.\n-meta.embedded.json.textmate.scope -comment",
13+
"L:source.json.comments.embedded .meta.settings. .meta.editor.tokenColorCustomizations. .meta.textMateRules. meta.structure.array.json.comments .meta.scope. string.quoted.double.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-.meta.textMateRules. meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments .meta.editor.tokenColorCustomizations.\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.scope.\n-.meta.scope. meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.embedded.json.textmate.scope -comment",
14+
"L:source.json.comments.embedded .meta.editor.tokenColorCustomizations. .meta.textMateRules. meta.structure.array.json.comments .meta.scope. string.quoted.double.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-.meta.textMateRules. meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments .meta.editor.tokenColorCustomizations.\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.scope.\n-.meta.scope. meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.embedded.json.textmate.scope -comment",
15+
"L:source.json.comments.embedded .meta.tokenColors. meta.structure.array.json.comments .meta.scope. string.quoted.double.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.scope.\n-.meta.scope. meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.embedded.json.textmate.scope -comment",
16+
"L:source.json.embedded .meta.tokenColors. meta.structure.array.json .meta.scope. string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json meta.structure.array.json meta.structure.array.json\n-meta.structure.array.json meta.structure.array.json .meta.scope.\n-.meta.scope. meta.structure.array.json meta.structure.array.json\n-meta.embedded.json.textmate.scope -comment"
1717
],
1818
"patterns": [
19-
{ "include": "#embeddedLanguages" }
19+
{ "include": "#balancedBracketScopes" },
20+
{ "include": "#tokenTypes" },
21+
{ "include": "#scopeNames" }
2022
],
2123
"repository": {
22-
"embeddedLanguages": {
23-
"begin": "(?<=\")\\G(?=(?>[^\\x00-\\x1F\"\\\\]++|\\\\.)++\")",
24-
"end": "(?=\"|$)",
25-
"name": "meta.embedded.json.textmate.source string.quoted.double.json",
24+
"balancedBracketScopes": {
25+
"comment": "balancedBracketScopes ONLY",
26+
"match": "(?<=(?:^|\\[)\\s*\")\\G\\*(?=\"\\s*(?:,|$))",
27+
"name": "keyword.control.any"
28+
},
29+
"tokenTypes": {
30+
"comment": "TODO: tokenTypes Type ONLY",
31+
"match": "(?<=:\\s*\")\\Gother(?=\")",
32+
"name": "meta.embedded.other"
33+
},
34+
"scopeNames": {
2635
"patterns": [
2736
{
28-
"begin": "(?>text|source|markdown)(?=\\.[\\w.:])",
37+
"begin": "(?<=\")\\G(?=(\\.(?>[^\\x00-\\x1F\"\\\\]++|\\\\.)*+)\")",
38+
"end": "(?=\"|$)",
39+
"name": "meta.embedded.json.textmate.scope .$1",
40+
"patterns": [
41+
{ "include": "#scopeName" },
42+
{ "include": "source.json.embedded#stringcontent" }
43+
]
44+
},
45+
{
46+
"begin": "(?<=\")\\G(?=((?>[^\\x00-\\x1F\"\\\\]++|\\\\.)++)\")",
47+
"end": "(?=\"|$)",
48+
"name": "meta.embedded.json.textmate.scope $1",
49+
"patterns": [
50+
{ "include": "#scopeName" },
51+
{ "include": "source.json.embedded#stringcontent" }
52+
]
53+
}
54+
],
55+
"repository": {
56+
"scopeName": {
57+
"begin": "(?<=\"| )(?>text|source|markdown)\\.(?=[\\w.:])",
2958
"end": "(?![\\w.:-])",
3059
"beginCaptures": { "0": { "name": "support.function.tm" } },
60+
"name": "string.quoted.double.json",
3161
"patterns": [
3262
{
3363
"match": "\\.",
3464
"name": "support.function.tm"
35-
}
65+
},
66+
{ "include": "source.json.embedded#stringcontent" }
3667
]
37-
},
38-
{
39-
"match": "\\.[\\w.:-]*",
40-
"name": ".$0"
41-
},
42-
{
43-
"match": "[\\w.:][\\w.:-]*",
44-
"name": "$0"
45-
},
46-
{
47-
"comment": "balancedBracketScopes ONLY",
48-
"match": "(?<=\")\\*(?=\")",
49-
"name": "keyword.control.any"
50-
},
51-
{
52-
"comment": "tokenTypes Type ONLY",
53-
"match": "(?<=\")other(?=\")",
54-
"name": "meta.embedded.other"
55-
},
56-
{ "include": "source.json.embedded#stringcontent" }
57-
]
68+
}
69+
}
5870
}
5971
}
6072
}

0 commit comments

Comments
 (0)