Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/dart/syntaxes/dart.tmLanguage.json
3314 views
1
{
2
"information_for_contributors": [
3
"This file has been converted from https://github.com/dart-lang/dart-syntax-highlight/blob/master/grammars/dart.json",
4
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
5
"Once accepted there, we are happy to receive an update request."
6
],
7
"version": "https://github.com/dart-lang/dart-syntax-highlight/commit/e1ac5c446c2531343393adbe8fff9d45d8a7c412",
8
"name": "Dart",
9
"scopeName": "source.dart",
10
"patterns": [
11
{
12
"name": "meta.preprocessor.script.dart",
13
"match": "^(#!.*)$"
14
},
15
{
16
"name": "meta.declaration.dart",
17
"begin": "^\\w*\\b(augment\\s+library|library|import\\s+augment|import|part\\s+of|part|export)\\b",
18
"beginCaptures": {
19
"0": {
20
"name": "keyword.other.import.dart"
21
}
22
},
23
"end": ";",
24
"endCaptures": {
25
"0": {
26
"name": "punctuation.terminator.dart"
27
}
28
},
29
"patterns": [
30
{
31
"include": "#strings"
32
},
33
{
34
"include": "#comments"
35
},
36
{
37
"name": "keyword.other.import.dart",
38
"match": "\\b(as|show|hide)\\b"
39
},
40
{
41
"name": "keyword.control.dart",
42
"match": "\\b(if)\\b"
43
}
44
]
45
},
46
{
47
"include": "#comments"
48
},
49
{
50
"include": "#punctuation"
51
},
52
{
53
"include": "#annotations"
54
},
55
{
56
"include": "#keywords"
57
},
58
{
59
"include": "#constants-and-special-vars"
60
},
61
{
62
"include": "#operators"
63
},
64
{
65
"include": "#strings"
66
}
67
],
68
"repository": {
69
"dartdoc-codeblock-triple": {
70
"begin": "^\\s*///\\s*(?!\\s*```)",
71
"end": "\n",
72
"contentName": "variable.other.source.dart"
73
},
74
"dartdoc-codeblock-block": {
75
"begin": "^\\s*\\*\\s*(?!(\\s*```|/))",
76
"end": "\n",
77
"contentName": "variable.other.source.dart"
78
},
79
"dartdoc": {
80
"patterns": [
81
{
82
"match": "(\\[.*?\\])",
83
"captures": {
84
"0": {
85
"name": "variable.name.source.dart"
86
}
87
}
88
},
89
{
90
"begin": "^\\s*///\\s*(```)",
91
"end": "^\\s*///\\s*(```)|^(?!\\s*///)",
92
"patterns": [
93
{
94
"include": "#dartdoc-codeblock-triple"
95
}
96
]
97
},
98
{
99
"begin": "^\\s*\\*\\s*(```)",
100
"end": "^\\s*\\*\\s*(```)|^(?=\\s*\\*/)",
101
"patterns": [
102
{
103
"include": "#dartdoc-codeblock-block"
104
}
105
]
106
},
107
{
108
"match": "`[^`\n]+`",
109
"name": "variable.other.source.dart"
110
},
111
{
112
"match": "(?:\\*|\\/\\/)\\s{4,}(.*?)(?=($|\\*\\/))",
113
"captures": {
114
"1": {
115
"name": "variable.other.source.dart"
116
}
117
}
118
}
119
]
120
},
121
"comments": {
122
"patterns": [
123
{
124
"name": "comment.block.empty.dart",
125
"match": "/\\*\\*/",
126
"captures": {
127
"0": {
128
"name": "punctuation.definition.comment.dart"
129
}
130
}
131
},
132
{
133
"include": "#comments-doc-oldschool"
134
},
135
{
136
"include": "#comments-doc"
137
},
138
{
139
"include": "#comments-inline"
140
}
141
]
142
},
143
"comments-doc-oldschool": {
144
"patterns": [
145
{
146
"name": "comment.block.documentation.dart",
147
"begin": "/\\*\\*",
148
"end": "\\*/",
149
"patterns": [
150
{
151
"include": "#comments-doc-oldschool"
152
},
153
{
154
"include": "#comments-block"
155
},
156
{
157
"include": "#dartdoc"
158
}
159
]
160
}
161
]
162
},
163
"comments-doc": {
164
"patterns": [
165
{
166
"name": "comment.block.documentation.dart",
167
"begin": "///",
168
"end": "^(?!\\s*///)",
169
"patterns": [
170
{
171
"include": "#dartdoc"
172
}
173
]
174
}
175
]
176
},
177
"comments-inline": {
178
"patterns": [
179
{
180
"include": "#comments-block"
181
},
182
{
183
"match": "((//).*)$",
184
"captures": {
185
"1": {
186
"name": "comment.line.double-slash.dart"
187
}
188
}
189
}
190
]
191
},
192
"comments-block": {
193
"patterns": [
194
{
195
"name": "comment.block.dart",
196
"begin": "/\\*",
197
"end": "\\*/",
198
"patterns": [
199
{
200
"include": "#comments-block"
201
}
202
]
203
}
204
]
205
},
206
"annotations": {
207
"patterns": [
208
{
209
"name": "storage.type.annotation.dart",
210
"match": "@[a-zA-Z]+"
211
}
212
]
213
},
214
"constants-and-special-vars": {
215
"patterns": [
216
{
217
"name": "constant.language.dart",
218
"match": "(?<!\\$)\\b(true|false|null)\\b(?!\\$)"
219
},
220
{
221
"name": "variable.language.dart",
222
"match": "(?<!\\$)\\b(this|super|augmented)\\b(?!\\$)"
223
},
224
{
225
"name": "constant.numeric.dart",
226
"match": "(?<!\\$)\\b((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(([0-9][0-9_]*\\.?[0-9_]*)|(\\.[0-9][0-9_]*))((e|E)(\\+|-)?[0-9][0-9_]*)?)\\b(?!\\$)"
227
},
228
{
229
"include": "#class-identifier"
230
},
231
{
232
"include": "#function-identifier"
233
}
234
]
235
},
236
"class-identifier": {
237
"patterns": [
238
{
239
"match": "(?<!\\$)\\b(bool|num|int|double|dynamic)\\b(?!\\$)",
240
"name": "support.class.dart"
241
},
242
{
243
"match": "(?<!\\$)\\bvoid\\b(?!\\$)",
244
"name": "storage.type.primitive.dart"
245
},
246
{
247
"begin": "(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*)\\b",
248
"end": "(?!<)",
249
"beginCaptures": {
250
"1": {
251
"name": "support.class.dart"
252
}
253
},
254
"patterns": [
255
{
256
"include": "#type-args"
257
}
258
]
259
}
260
]
261
},
262
"function-identifier": {
263
"patterns": [
264
{
265
"match": "([_$]*[a-z][a-zA-Z0-9_$]*)(<(?:[a-zA-Z0-9_$<>?]|,\\s*|\\s+extends\\s+)+>)?[!?]?\\(",
266
"captures": {
267
"1": {
268
"name": "entity.name.function.dart"
269
},
270
"2": {
271
"patterns": [
272
{
273
"include": "#type-args"
274
}
275
]
276
}
277
}
278
}
279
]
280
},
281
"type-args": {
282
"begin": "(<)",
283
"end": "(>)",
284
"beginCaptures": {
285
"1": {
286
"name": "other.source.dart"
287
}
288
},
289
"endCaptures": {
290
"1": {
291
"name": "other.source.dart"
292
}
293
},
294
"patterns": [
295
{
296
"include": "#class-identifier"
297
},
298
{
299
"match": ","
300
},
301
{
302
"name": "keyword.declaration.dart",
303
"match": "extends"
304
},
305
{
306
"include": "#comments"
307
}
308
]
309
},
310
"keywords": {
311
"patterns": [
312
{
313
"name": "keyword.cast.dart",
314
"match": "(?<!\\$)\\bas\\b(?!\\$)"
315
},
316
{
317
"name": "keyword.control.catch-exception.dart",
318
"match": "(?<!\\$)\\b(try|on|catch|finally|throw|rethrow)\\b(?!\\$)"
319
},
320
{
321
"name": "keyword.control.dart",
322
"match": "(?<!\\$)\\b(break|case|continue|default|do|else|for|if|in|switch|while|when)\\b(?!\\$)"
323
},
324
{
325
"name": "keyword.control.dart",
326
"match": "(?<!\\$)\\b(sync(\\*)?|async(\\*)?|await|yield(\\*)?)\\b(?!\\$)"
327
},
328
{
329
"name": "keyword.control.dart",
330
"match": "(?<!\\$)\\bassert\\b(?!\\$)"
331
},
332
{
333
"name": "keyword.control.new.dart",
334
"match": "(?<!\\$)\\b(new)\\b(?!\\$)"
335
},
336
{
337
"name": "keyword.control.return.dart",
338
"match": "(?<!\\$)\\b(return)\\b(?!\\$)"
339
},
340
{
341
"name": "keyword.declaration.dart",
342
"match": "(?<!\\$)\\b(abstract|sealed|base|interface|class|enum|extends|extension\\s+type|extension|external|factory|implements|get(?![(<])|mixin|native|operator|set(?![(<])|typedef|with|covariant)\\b(?!\\$)"
343
},
344
{
345
"name": "storage.modifier.dart",
346
"match": "(?<!\\$)\\b(macro|augment|static|final|const|required|late)\\b(?!\\$)"
347
},
348
{
349
"name": "storage.type.primitive.dart",
350
"match": "(?<!\\$)\\b(?:void|var)\\b(?!\\$)"
351
}
352
]
353
},
354
"operators": {
355
"patterns": [
356
{
357
"name": "keyword.operator.dart",
358
"match": "(?<!\\$)\\b(is\\!?)\\b(?!\\$)"
359
},
360
{
361
"name": "keyword.operator.ternary.dart",
362
"match": "\\?|:"
363
},
364
{
365
"name": "keyword.operator.bitwise.dart",
366
"match": "(<<|>>>?|~|\\^|\\||&)"
367
},
368
{
369
"name": "keyword.operator.assignment.bitwise.dart",
370
"match": "((&|\\^|\\||<<|>>>?)=)"
371
},
372
{
373
"name": "keyword.operator.closure.dart",
374
"match": "(=>)"
375
},
376
{
377
"name": "keyword.operator.comparison.dart",
378
"match": "(==|!=|<=?|>=?)"
379
},
380
{
381
"name": "keyword.operator.assignment.arithmetic.dart",
382
"match": "(([+*/%-]|\\~)=)"
383
},
384
{
385
"name": "keyword.operator.assignment.dart",
386
"match": "(=)"
387
},
388
{
389
"name": "keyword.operator.increment-decrement.dart",
390
"match": "(\\-\\-|\\+\\+)"
391
},
392
{
393
"name": "keyword.operator.arithmetic.dart",
394
"match": "(\\-|\\+|\\*|\\/|\\~\\/|%)"
395
},
396
{
397
"name": "keyword.operator.logical.dart",
398
"match": "(!|&&|\\|\\|)"
399
}
400
]
401
},
402
"expression": {
403
"patterns": [
404
{
405
"include": "#constants-and-special-vars"
406
},
407
{
408
"include": "#strings"
409
},
410
{
411
"name": "variable.parameter.dart",
412
"match": "[a-zA-Z0-9_]+"
413
},
414
{
415
"begin": "\\{",
416
"end": "\\}",
417
"patterns": [
418
{
419
"include": "#expression"
420
}
421
]
422
}
423
]
424
},
425
"string-interp": {
426
"patterns": [
427
{
428
"name": "meta.embedded.expression.dart",
429
"match": "\\$([a-zA-Z0-9_]+)",
430
"captures": {
431
"1": {
432
"name": "variable.parameter.dart"
433
}
434
}
435
},
436
{
437
"name": "meta.embedded.expression.dart",
438
"begin": "\\$\\{",
439
"end": "\\}",
440
"patterns": [
441
{
442
"include": "#expression"
443
}
444
]
445
},
446
{
447
"name": "constant.character.escape.dart",
448
"match": "\\\\."
449
}
450
]
451
},
452
"strings": {
453
"patterns": [
454
{
455
"name": "string.interpolated.triple.double.dart",
456
"begin": "(?<!r)\"\"\"",
457
"end": "\"\"\"(?!\")",
458
"patterns": [
459
{
460
"include": "#string-interp"
461
}
462
]
463
},
464
{
465
"name": "string.interpolated.triple.single.dart",
466
"begin": "(?<!r)'''",
467
"end": "'''(?!')",
468
"patterns": [
469
{
470
"include": "#string-interp"
471
}
472
]
473
},
474
{
475
"name": "string.quoted.triple.double.dart",
476
"begin": "r\"\"\"",
477
"end": "\"\"\"(?!\")"
478
},
479
{
480
"name": "string.quoted.triple.single.dart",
481
"begin": "r'''",
482
"end": "'''(?!')"
483
},
484
{
485
"name": "string.interpolated.double.dart",
486
"begin": "(?<!\\|r)\"",
487
"end": "\"",
488
"patterns": [
489
{
490
"name": "invalid.string.newline",
491
"match": "\\n"
492
},
493
{
494
"include": "#string-interp"
495
}
496
]
497
},
498
{
499
"name": "string.quoted.double.dart",
500
"begin": "r\"",
501
"end": "\"",
502
"patterns": [
503
{
504
"name": "invalid.string.newline",
505
"match": "\\n"
506
}
507
]
508
},
509
{
510
"name": "string.interpolated.single.dart",
511
"begin": "(?<!\\|r)'",
512
"end": "'",
513
"patterns": [
514
{
515
"name": "invalid.string.newline",
516
"match": "\\n"
517
},
518
{
519
"include": "#string-interp"
520
}
521
]
522
},
523
{
524
"name": "string.quoted.single.dart",
525
"begin": "r'",
526
"end": "'",
527
"patterns": [
528
{
529
"name": "invalid.string.newline",
530
"match": "\\n"
531
}
532
]
533
}
534
]
535
},
536
"punctuation": {
537
"patterns": [
538
{
539
"name": "punctuation.comma.dart",
540
"match": ","
541
},
542
{
543
"name": "punctuation.terminator.dart",
544
"match": ";"
545
},
546
{
547
"name": "punctuation.dot.dart",
548
"match": "\\."
549
}
550
]
551
}
552
}
553
}
554