View raw

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