Skip to content

Commit c202029

Browse files
committed
Add basic support for "variables"
1 parent a02ccb6 commit c202029

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

syntaxes/json.tmLanguage.json

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
{ "include": "#foldingStopMarker" },
6666
{ "include": "#injectionSelector" },
6767
{ "include": "#injections" },
68+
{ "include": "#variables" },
6869
{ "include": "#patterns" },
6970
{ "include": "#repository" },
7071
{ "include": "#uuid" },
@@ -86,6 +87,7 @@
8687
{ "include": "#foldingStopMarker" },
8788
{ "include": "#injectionSelector" },
8889
{ "include": "#injections" },
90+
{ "include": "#variables" },
8991
{ "include": "#include" },
9092
{ "include": "#applyEndPatternLast" },
9193
{ "include": "#patterns" },
@@ -592,6 +594,74 @@
592594
{ "include": "#dictionary-separator" }
593595
]
594596
},
597+
"variables": {
598+
"comment": "\"variables\": { ... }",
599+
"begin": "(\")(variables)(\")",
600+
"end": "(?<=\")(?!\\G)|(?=[},])",
601+
"beginCaptures": {
602+
"1": { "name": "punctuation.definition.string.begin.json.tm" },
603+
"2": { "name": "keyword.property-name.string.variables.json.tm" },
604+
"3": { "name": "punctuation.definition.string.end.json.tm" }
605+
},
606+
"patterns": [
607+
{
608+
"begin": ":",
609+
"end": "(?<=})|(?=[},])",
610+
"beginCaptures": { "0": { "name": "punctuation.separator.dictionary.key-value.json.tm" } },
611+
"patterns": [
612+
{
613+
"begin": "{",
614+
"end": "}",
615+
"beginCaptures": { "0": { "name": "punctuation.definition.dictionary.begin.json.tm" } },
616+
"endCaptures": { "0": { "name": "punctuation.definition.dictionary.end.json.tm" } },
617+
"patterns": [
618+
{
619+
"comment": "\"...\": \" ... \"",
620+
"begin": "(?=\")",
621+
"end": "(?=[},])",
622+
"patterns": [
623+
{
624+
"begin": "\"",
625+
"end": "\"",
626+
"beginCaptures": { "0": { "name": "punctuation.definition.string.begin.json.tm" } },
627+
"endCaptures": { "0": { "name": "punctuation.definition.string.end.json.tm" } },
628+
"contentName": "variable.json.tm regex",
629+
"patterns": [ { "include": "#escape-characters" } ]
630+
},
631+
{
632+
"begin": ":",
633+
"end": "(?<=\")|(?=[},])",
634+
"beginCaptures": { "0": { "name": "punctuation.separator.dictionary.key-value.json.tm" } },
635+
"patterns": [
636+
{
637+
"begin": "\"",
638+
"end": "\"",
639+
"beginCaptures": { "0": { "name": "punctuation.definition.string.begin.json.tm" } },
640+
"endCaptures": { "0": { "name": "punctuation.definition.string.end.json.tm" } },
641+
"contentName": "meta.embedded.json.textmate.regexp",
642+
"patterns": [
643+
{ "include": "source.json.textmate.regexp" },
644+
{
645+
"comment": "Fallback if `source.json.textmate.regexp` fails",
646+
"include": "#escape-characters"
647+
}
648+
]
649+
},
650+
{ "include": "#json-value" }
651+
]
652+
},
653+
{ "include": "#dictionary-separator" }
654+
]
655+
},
656+
{ "include": "#dictionary-separator" }
657+
]
658+
},
659+
{ "include": "#json-value" }
660+
]
661+
},
662+
{ "include": "#dictionary-separator" }
663+
]
664+
},
595665
"patterns": {
596666
"comment": "\"patterns\": [ ... ]",
597667
"begin": "(\")(patterns)(\")",
@@ -715,7 +785,8 @@
715785
},
716786
{ "include": "#json-value" }
717787
]
718-
}
788+
},
789+
{ "include": "#dictionary-separator" }
719790
]
720791
},
721792
"name": {

0 commit comments

Comments
 (0)