Skip to content

Commit 8d3504e

Browse files
committed
fix: Standard Token Type override
1 parent 18aa991 commit 8d3504e

File tree

7 files changed

+1526
-1400
lines changed

7 files changed

+1526
-1400
lines changed

syntaxes/JSON.tmLanguage.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,19 @@
6969
"patterns": [
7070
{
7171
"comment": "Apply a targetable scopeName to the entire object. Attempt to remove all non-scope characters; as they are not targetable",
72-
"begin": "(?=\"\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(?<scope>(?>[0-9A-Za-z_.:-]++|\\\\u00(?i:2[DE]|3[0-9A]|4[1-9A-F]|5[0-9AF]|6[1-9A-F]|7[0-9A]))*+)\\g<separator>(?<string>(?>[^\\\\\"]++|\\\\.)*+)(?<separator>(?>[^0-9A-Za-z_.:\\\\\"]++|\\\\u(?!00(?i:2[DE]|3[0-9A]|4[1-9A-F]|5[0-9AF]|6[1-9A-F]|7[0-9A]))\\h{1,4}|\\\\.?)*+){0}\")",
72+
"begin": "(?x)(?=\"\n\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>\n(?<scope>[0-9A-Za-z_.:-]*+)\n\\g<separator>\n(?<string>(?>[^\\\\\"]++|\\\\.)*+)\n(?<separator>(?>[^\\\\\"0-9A-Za-z_.:-]++|\\\\u\\h{,4}|\\\\.?)*+){0}\n\")",
7373
"end": "(?!\\G)(?<=,)|(?=})",
7474
"name": ".meta.$1$2$3$4$5$6$7$8$9.",
75-
"patterns": [ { "include": "#objectpair" } ]
75+
"patterns": [
76+
{
77+
"comment": "Resets standard token type back to other",
78+
"begin": "(?=\\G\"(?>[^crs\\\\\"]++|\\\\.|(?!\\bcomment\\b)c+|(?!\\bregex\\b)r+|(?!\\bstring\\b)s+)*\\b(?>comment|regex|string)\\b)",
79+
"end": "(?!\\G)(?<=,)|(?=})",
80+
"name": "meta.embedded",
81+
"patterns": [ { "include": "#objectpair" } ]
82+
},
83+
{ "include": "#objectpair" }
84+
]
7685
},
7786
{ "include": "#objectpair" }
7887
]

syntaxes/JSONC.tmLanguage.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,19 @@
7474
"patterns": [
7575
{
7676
"comment": "Apply a targetable scopeName to the entire object. Attempt to remove all non-scope characters; as they are not targetable",
77-
"begin": "(?=\"\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(?<scope>(?>[0-9A-Za-z_.:-]++|\\\\u00(?i:2[DE]|3[0-9A]|4[1-9A-F]|5[0-9AF]|6[1-9A-F]|7[0-9A]))*+)\\g<separator>(?<string>(?>[^\\\\\"]++|\\\\.)*+)(?<separator>(?>[^0-9A-Za-z_.:\\\\\"]++|\\\\u(?!00(?i:2[DE]|3[0-9A]|4[1-9A-F]|5[0-9AF]|6[1-9A-F]|7[0-9A]))\\h{1,4}|\\\\.?)*+){0}\")",
77+
"begin": "(?x)(?=\"\n\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>(\\g<scope>)\\g<separator>\n(?<scope>[0-9A-Za-z_.:-]*+)\n\\g<separator>\n(?<string>(?>[^\\\\\"]++|\\\\.)*+)\n(?<separator>(?>[^\\\\\"0-9A-Za-z_.:-]++|\\\\u\\h{,4}|\\\\.?)*+){0}\n\")",
7878
"end": "(?!\\G)(?<=,)|(?=})",
7979
"name": ".meta.$1$2$3$4$5$6$7$8$9.",
80-
"patterns": [ { "include": "#objectpair" } ]
80+
"patterns": [
81+
{
82+
"comment": "Resets standard token type back to other",
83+
"begin": "(?=\\G\"(?>[^crs\\\\\"]++|\\\\.|(?!\\bcomment\\b)c+|(?!\\bregex\\b)r+|(?!\\bstring\\b)s+)*+\\b(?>comment|regex|string)\\b)",
84+
"end": "(?!\\G)(?<=,)|(?=})",
85+
"name": "meta.embedded",
86+
"patterns": [ { "include": "#objectpair" } ]
87+
},
88+
{ "include": "#objectpair" }
89+
]
8190
},
8291
{ "include": "#objectpair" }
8392
]

syntaxes/tests/JSON/negatives.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
{
2+
"comment": [
3+
"comment",
4+
"brackets should work"
5+
],
6+
"not-string": [
7+
"not-string",
8+
"brackets should work"
9+
],
10+
"not@regex": [
11+
"not@regex",
12+
"brackets should work"
13+
],
14+
"not@-comment": [
15+
"not@comment",
16+
"brackets should work"
17+
],
218
"embeddedLanguages": {
319
"contributes": {
420
"grammars": [

0 commit comments

Comments
 (0)