Skip to content

Commit 44e38c7

Browse files
committed
Initial Release
1 parent 45581e7 commit 44e38c7

1 file changed

Lines changed: 93 additions & 3 deletions

File tree

syntaxes/package.json.tmLanguage.json

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,97 @@
22
"$schema": "https://raw.githubusercontent.com/RedCMD/TmLanguage-Syntax-Highlighter/main/vscode.tmLanguage.schema.json",
33
"name": "package.json",
44
"scopeName": "source.json.package",
5-
"injectionSelector": "L:source.json -string -comment",
6-
"patterns": [ ],
7-
"repository": { }
5+
"injectionSelector": "L:source.json meta.structure.dictionary.json -meta.embedded.shellscript.json.package -meta.structure.dictionary.value.json -meta.structure.array.json -string -comment",
6+
"patterns": [
7+
{ "include": "#scripts" }
8+
],
9+
"repository": {
10+
"scripts": {
11+
"begin": "(?=\"scripts\")",
12+
"end": "(?<=,)|(?=})",
13+
"name": "meta.embedded.shellscript.json.package",
14+
"patterns": [
15+
{ "include": "source.json#objectkey" },
16+
{
17+
"comment": "Taken straight from `source.json`",
18+
"begin": ":",
19+
"beginCaptures": { "0": { "name": "punctuation.separator.dictionary.key-value.json" } },
20+
"end": "(,)|(?=\\})",
21+
"endCaptures": { "1": { "name": "punctuation.separator.dictionary.pair.json" } },
22+
"name": "meta.structure.dictionary.value.json",
23+
"patterns": [
24+
{
25+
"begin": "\\{",
26+
"beginCaptures": { "0": { "name": "punctuation.definition.dictionary.begin.json" } },
27+
"end": "\\}",
28+
"endCaptures": { "0": { "name": "punctuation.definition.dictionary.end.json" } },
29+
"name": "meta.structure.dictionary.json",
30+
"patterns": [
31+
{
32+
"comment": "the JSON object key",
33+
"include": "source.json#objectkey"
34+
},
35+
{ "include": "source.json#comments" },
36+
{
37+
"begin": ":",
38+
"beginCaptures": { "0": { "name": "punctuation.separator.dictionary.key-value.json" } },
39+
"end": "(,)|(?=\\})",
40+
"endCaptures": { "1": { "name": "punctuation.separator.dictionary.pair.json" } },
41+
"name": "meta.structure.dictionary.value.json",
42+
"patterns": [
43+
{
44+
"comment": "VSCode TextMate bug. For some reason, including a grammar from within a capture group doesn't load the include. We have to pre-load the include outside of a capture group. `source.shell`",
45+
"begin": "(*FAIL)",
46+
"end": "|",
47+
"patterns": [ { "include": "source.shell" } ]
48+
},
49+
{
50+
"match": "(\")((?>[^\\\\\"]++|\\\\.)++)(\")",
51+
"captures": {
52+
"0": { "name": "string.quoted.double.json" },
53+
"1": { "name": "punctuation.definition.string.begin.json.package" },
54+
"2": {
55+
"name": "meta.embedded.shellscript.json.package",
56+
"patterns": [
57+
{
58+
"comment": "Setup a `\\G` anchor for ShellScript to use",
59+
"begin": "|",
60+
"end": "(*FAIL)",
61+
"patterns": [ { "include": "source.shell" } ]
62+
},
63+
{ "include": "source.json#stringcontent" }
64+
]
65+
},
66+
"3": { "name": "punctuation.definition.string.end.json.package" }
67+
}
68+
},
69+
{
70+
"comment": "the JSON object value",
71+
"include": "source.json#value"
72+
},
73+
{
74+
"match": "[^\\s,]",
75+
"name": "invalid.illegal.expected-dictionary-separator.json"
76+
}
77+
]
78+
},
79+
{
80+
"match": "[^\\s\\}]",
81+
"name": "invalid.illegal.expected-dictionary-separator.json"
82+
}
83+
]
84+
},
85+
{
86+
"comment": "the JSON object value",
87+
"include": "source.json#value"
88+
},
89+
{
90+
"match": "[^\\s,]",
91+
"name": "invalid.illegal.expected-dictionary-separator.json"
92+
}
93+
]
94+
}
95+
]
96+
}
97+
}
898
}

0 commit comments

Comments
 (0)