1+ {
2+ "$schema" : " https://raw.githubusercontent.com/RedCMD/TmLanguage-Syntax-Highlighter/main/vscode.tmLanguage.schema.json" ,
3+ "name" : " JSON with Comments" ,
4+ "scopeName" : " source.json.comments" ,
5+ "patterns" : [
6+ { "include" : " #value" }
7+ ],
8+ "repository" : {
9+ "array" : {
10+ "begin" : " \\ [" ,
11+ "beginCaptures" : { "0" : { "name" : " punctuation.definition.array.begin.json.comments" } },
12+ "end" : " ]" ,
13+ "endCaptures" : { "0" : { "name" : " punctuation.definition.array.end.json.comments" } },
14+ "name" : " meta.structure.array.json.comments" ,
15+ "patterns" : [
16+ { "include" : " #value" },
17+ {
18+ "match" : " ," ,
19+ "name" : " punctuation.separator.array.json.comments"
20+ },
21+ {
22+ "match" : " \\ S" ,
23+ "name" : " invalid.illegal.expected-array-separator.json.comments"
24+ }
25+ ]
26+ },
27+ "comments" : {
28+ "patterns" : [
29+ {
30+ "begin" : " /\\ *\\ *(?!/)" ,
31+ "captures" : { "0" : { "name" : " punctuation.definition.comment.json.comments" } },
32+ "end" : " \\ */" ,
33+ "name" : " comment.block.documentation.json.comments"
34+ },
35+ {
36+ "begin" : " /\\ *" ,
37+ "captures" : { "0" : { "name" : " punctuation.definition.comment.json.comments" } },
38+ "end" : " \\ */" ,
39+ "name" : " comment.block.json.comments"
40+ },
41+ {
42+ "begin" : " //" ,
43+ "end" : " $" ,
44+ "beginCaptures" : { "0" : { "name" : " punctuation.definition.comment.json.comments" } },
45+ "name" : " comment.line.double-slash.js"
46+ }
47+ ]
48+ },
49+ "constant" : {
50+ "match" : " \\ b(?>true|false|null)\\ b" ,
51+ "name" : " constant.language.json.comments"
52+ },
53+ "number" : {
54+ "match" : " -?(?>0|[1-9][0-9]*)(?>(?>\\ .[0-9]+)?(?>[eE][+-]?[0-9]+)?)?" ,
55+ "name" : " constant.numeric.json.comments"
56+ },
57+ "object" : {
58+ "begin" : " {" ,
59+ "beginCaptures" : { "0" : { "name" : " punctuation.definition.dictionary.begin.json.comments" } },
60+ "end" : " }" ,
61+ "endCaptures" : { "0" : { "name" : " punctuation.definition.dictionary.end.json.comments" } },
62+ "name" : " meta.structure.dictionary.json.comments" ,
63+ "patterns" : [
64+ {
65+ "begin" : " (?=\" ((?>[^\\\\\" ]++|\\\\ .)*+)\" )" ,
66+ "end" : " (?<=,)|(?=})" ,
67+ "name" : " .$1." ,
68+ "patterns" : [ { "include" : " #objectpair" } ]
69+ },
70+ { "include" : " #objectpair" }
71+ ]
72+ },
73+ "objectpair" : {
74+ "patterns" : [
75+ {
76+ "comment" : " the JSON object key" ,
77+ "include" : " #objectkey"
78+ },
79+ { "include" : " #comments" },
80+ {
81+ "begin" : " :" ,
82+ "beginCaptures" : { "0" : { "name" : " punctuation.separator.dictionary.key-value.json.comments" } },
83+ "end" : " (,)|(?=})" ,
84+ "endCaptures" : { "1" : { "name" : " punctuation.separator.dictionary.pair.json.comments" } },
85+ "name" : " meta.structure.dictionary.value.json.comments" ,
86+ "patterns" : [
87+ {
88+ "comment" : " the JSON object value" ,
89+ "include" : " #value"
90+ },
91+ {
92+ "match" : " \\ S" ,
93+ "name" : " invalid.illegal.expected-dictionary-separator.json.comments"
94+ }
95+ ]
96+ },
97+ {
98+ "match" : " \\ S" ,
99+ "name" : " invalid.illegal.expected-dictionary-separator.json.comments"
100+ }
101+ ]
102+ },
103+ "string" : {
104+ "begin" : " \" " ,
105+ "beginCaptures" : { "0" : { "name" : " punctuation.definition.string.begin.json.comments" } },
106+ "end" : " \" " ,
107+ "endCaptures" : { "0" : { "name" : " punctuation.definition.string.end.json.comments" } },
108+ "name" : " string.quoted.double.json.comments" ,
109+ "patterns" : [ { "include" : " #stringcontent" } ]
110+ },
111+ "objectkey" : {
112+ "begin" : " \" " ,
113+ "beginCaptures" : { "0" : { "name" : " punctuation.support.type.property-name.begin.json.comments" } },
114+ "end" : " \" " ,
115+ "endCaptures" : { "0" : { "name" : " punctuation.support.type.property-name.end.json.comments" } },
116+ "name" : " string.json.comments support.type.property-name.json.comments" ,
117+ "patterns" : [ { "include" : " #stringcontent" } ]
118+ },
119+ "stringcontent" : {
120+ "patterns" : [
121+ {
122+ "match" : " \\\\ (?>[\"\\\\ /bfnrt]|u[0-9a-fA-F]{4})" ,
123+ "name" : " constant.character.escape.json.comments"
124+ },
125+ {
126+ "match" : " \\\\ ." ,
127+ "name" : " invalid.illegal.unrecognized-string-escape.json.comments"
128+ }
129+ ]
130+ },
131+ "value" : {
132+ "patterns" : [
133+ { "include" : " #constant" },
134+ { "include" : " #number" },
135+ { "include" : " #string" },
136+ { "include" : " #array" },
137+ { "include" : " #object" },
138+ { "include" : " #comments" }
139+ ]
140+ }
141+ }
142+ }
0 commit comments