PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.5.0
Code Block Pro – Beautiful Syntax Highlighting v1.5.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / hcl.tmLanguage.json

hcl.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.5.0, at build/shiki/languages/hcl.tmLanguage.json

388 lines 8.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "name": "hcl",
3 "scopeName": "source.hcl",
4 "comment": "HashiCorp Configuration Language",
5 "fileTypes": ["tf", "tfvars", "nomad", "hcl", "appfile"],
6 "patterns": [
7 {
8 "include": "#comments"
9 },
10 {
11 "include": "#constructs"
12 },
13 {
14 "include": "#variable"
15 }
16 ],
17 "repository": {
18 "comments": {
19 "patterns": [
20 {
21 "comment": "Single line comments with number-sign",
22 "match": "(#)+(.*)",
23 "captures": {
24 "0": {
25 "name": "comment.line.number-sign.hcl"
26 }
27 }
28 },
29 {
30 "comment": "Single line comments with double-slash",
31 "match": "(//)+(.*)",
32 "captures": {
33 "0": {
34 "name": "comment.line.double-slash.hcl"
35 }
36 }
37 },
38 {
39 "comment": "Multiple line comment block",
40 "begin": "/\\*",
41 "beginCaptures": {
42 "0": {
43 "name": "comment.block.documentation.hcl"
44 }
45 },
46 "end": "\\*/",
47 "endCaptures": {
48 "0": {
49 "name": "comment.block.documentation.hcl"
50 }
51 },
52 "contentName": "comment.block.documentation.hcl"
53 }
54 ]
55 },
56 "constructs": {
57 "patterns": [
58 {
59 "begin": "([\\w-]+)\\s*\\{",
60 "beginCaptures": {
61 "0": {
62 "name": "meta.function.hcl"
63 },
64 "1": {
65 "name": "storage.type.hcl"
66 }
67 },
68 "end": "\\}",
69 "patterns": [
70 {
71 "include": "$self"
72 },
73 {
74 "include": "#comments"
75 },
76 {
77 "include": "#variable"
78 }
79 ]
80 },
81 {
82 "begin": "([\\w-]+)((?:\\s*\"[^\"]*\")*)\\s*\\{",
83 "beginCaptures": {
84 "0": {
85 "name": "meta.function.hcl"
86 },
87 "1": {
88 "name": "storage.type.hcl"
89 },
90 "2": {
91 "name": "string.quoted.double.hcl"
92 }
93 },
94 "end": "\\}",
95 "patterns": [
96 {
97 "include": "$self"
98 },
99 {
100 "include": "#comments"
101 },
102 {
103 "include": "#variable"
104 }
105 ]
106 }
107 ]
108 },
109 "variable": {
110 "patterns": [
111 {
112 "begin": "([\\w\\.-]+)\\s*(=)\\s*",
113 "beginCaptures": {
114 "1": {
115 "name": "variable.parameter.hcl"
116 },
117 "2": {
118 "name": "keyword.operator.hcl"
119 }
120 },
121 "end": "(?<!\\2)$",
122 "endCaptures": {
123 "0": {
124 "name": "keyword.operator.hcl"
125 }
126 },
127 "patterns": [
128 {
129 "include": "#variable-type-string"
130 },
131 {
132 "include": "#variable-type-heredoc"
133 },
134 {
135 "include": "#variable-type-hexadecimal"
136 },
137 {
138 "include": "#variable-type-decimal"
139 },
140 {
141 "include": "#variable-type-constant"
142 },
143 {
144 "include": "#variable-type-array"
145 },
146 {
147 "include": "#variable-type-map"
148 }
149 ]
150 }
151 ]
152 },
153 "variable-interpolation": {
154 "patterns": [
155 {
156 "begin": "\\$\\{",
157 "beginCaptures": {
158 "0": {
159 "name": "keyword.operator.hcl"
160 }
161 },
162 "end": "\\}",
163 "endCaptures": {
164 "0": {
165 "name": "keyword.operator.hcl"
166 }
167 },
168 "patterns": [
169 {
170 "include": "#variable-interpolation-function"
171 },
172 {
173 "include": "#variable-interpolation-reference"
174 }
175 ]
176 }
177 ]
178 },
179 "variable-interpolation-function": {
180 "patterns": [
181 {
182 "begin": "([\\w-]+)\\(",
183 "beginCaptures": {
184 "1": {
185 "name": "entity.name.function.hcl"
186 }
187 },
188 "end": "\\)",
189 "patterns": [
190 {
191 "include": "#variable-interpolation-function"
192 },
193 {
194 "include": "#variable-interpolation-reference"
195 },
196 {
197 "include": "#variable-type-hexadecimal"
198 },
199 {
200 "include": "#variable-type-decimal"
201 },
202 {
203 "include": "#variable-type-constant"
204 },
205 {
206 "include": "#variable-type-string"
207 }
208 ]
209 }
210 ]
211 },
212 "variable-interpolation-reference": {
213 "patterns": [
214 {
215 "match": "\\b([\\w-]+)((\\.[\\w-]+)*)\\b",
216 "captures": {
217 "1": {
218 "name": "storage.modifier.hcl"
219 },
220 "2": {
221 "name": "entity.name.type.hcl"
222 }
223 }
224 }
225 ]
226 },
227 "variable-type-array": {
228 "patterns": [
229 {
230 "begin": "\\[",
231 "end": "\\]",
232 "patterns": [
233 {
234 "include": "#variable-type-decimal"
235 },
236 {
237 "include": "#variable-type-hexadecimal"
238 },
239 {
240 "include": "#variable-type-constant"
241 },
242 {
243 "include": "#variable-type-string"
244 },
245 {
246 "match": "\\s*,\\s*"
247 }
248 ]
249 }
250 ]
251 },
252 "variable-type-map": {
253 "patterns": [
254 {
255 "begin": "\\{",
256 "end": "\\}",
257 "patterns": [
258 {
259 "begin": "(\"[\\w\\s\\.-]+\")\\s*(:)",
260 "beginCaptures": {
261 "1": {
262 "name": "string.quoted.double.hcl"
263 },
264 "2": {
265 "name": "keyword.operator.hcl"
266 }
267 },
268 "end": "(?<!\\2)\\s*($|(?=\\}))",
269 "endCaptures": {
270 "0": {
271 "name": "keyword.operator.hcl"
272 }
273 },
274 "patterns": [
275 {
276 "include": "#variable-type-decimal"
277 },
278 {
279 "include": "#variable-type-hexadecimal"
280 },
281 {
282 "include": "#variable-type-constant"
283 },
284 {
285 "include": "#variable-type-string"
286 },
287 {
288 "match": "\\s*,\\s*"
289 }
290 ]
291 }
292 ]
293 }
294 ]
295 },
296 "variable-type-hexadecimal": {
297 "patterns": [
298 {
299 "comment": "Numbers in hexadecimal with optional suffixes",
300 "match": "0x[0-9A-Fa-f]+([kKmMgG]b?)?",
301 "captures": {
302 "0": {
303 "name": "constant.numeric.hcl"
304 }
305 }
306 }
307 ]
308 },
309 "variable-type-decimal": {
310 "patterns": [
311 {
312 "comment": "Numbers in decimal with optional suffixes",
313 "match": "\\b[0-9\\.]+([kKmMgG]b?)?\\b",
314 "captures": {
315 "0": {
316 "name": "constant.numeric.hcl"
317 }
318 }
319 }
320 ]
321 },
322 "variable-type-constant": {
323 "patterns": [
324 {
325 "match": "\\b(true|false|yes|no|on|off)\\b",
326 "captures": {
327 "0": {
328 "name": "constant.numeric.hcl"
329 }
330 }
331 }
332 ]
333 },
334 "variable-type-string": {
335 "patterns": [
336 {
337 "comment": "Usual string",
338 "begin": "\"",
339 "beginCaptures": {
340 "0": {
341 "name": "string.quoted.double.hcl"
342 }
343 },
344 "end": "\"",
345 "endCaptures": {
346 "0": {
347 "name": "string.quoted.double.hcl"
348 }
349 },
350 "patterns": [
351 {
352 "include": "#variable-interpolation"
353 },
354 {
355 "match": "[^\"]",
356 "captures": {
357 "0": {
358 "name": "string.quoted.double.hcl"
359 }
360 }
361 }
362 ]
363 }
364 ]
365 },
366 "variable-type-heredoc": {
367 "patterns": [
368 {
369 "comment": "Heredoc string",
370 "begin": "<<(\\w+)",
371 "beginCaptures": {
372 "0": {
373 "name": "entity.name.section"
374 }
375 },
376 "end": "^\\s*\\1$",
377 "endCaptures": {
378 "0": {
379 "name": "entity.name.section"
380 }
381 },
382 "contentName": "string.unquoted.here-doc.hcl"
383 }
384 ]
385 }
386 }
387 }
388