View raw

1 { 2 "information_for_contributors": [ 3 "This file has been converted from https://github.com/worlpaker/go-syntax/blob/master/syntaxes/go.tmLanguage.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/worlpaker/go-syntax/commit/c74e22eb9ef32958e3edd130ea750ce78d8b8241", 8 "name": "Go", 9 "scopeName": "source.go", 10 "patterns": [ 11 { 12 "include": "#statements" 13 } 14 ], 15 "repository": { 16 "statements": { 17 "patterns": [ 18 { 19 "include": "#package_name" 20 }, 21 { 22 "include": "#import" 23 }, 24 { 25 "include": "#syntax_errors" 26 }, 27 { 28 "include": "#group-functions" 29 }, 30 { 31 "include": "#group-types" 32 }, 33 { 34 "include": "#group-variables" 35 }, 36 { 37 "include": "#hover" 38 } 39 ] 40 }, 41 "group-functions": { 42 "comment": "all statements related to functions", 43 "patterns": [ 44 { 45 "include": "#function_declaration" 46 }, 47 { 48 "include": "#functions_inline" 49 }, 50 { 51 "include": "#functions" 52 }, 53 { 54 "include": "#built_in_functions" 55 }, 56 { 57 "include": "#support_functions" 58 } 59 ] 60 }, 61 "group-types": { 62 "comment": "all statements related to types", 63 "patterns": [ 64 { 65 "include": "#other_struct_interface_expressions" 66 }, 67 { 68 "include": "#type_assertion_inline" 69 }, 70 { 71 "include": "#struct_variables_types" 72 }, 73 { 74 "include": "#interface_variables_types" 75 }, 76 { 77 "include": "#single_type" 78 }, 79 { 80 "include": "#multi_types" 81 }, 82 { 83 "include": "#struct_interface_declaration" 84 }, 85 { 86 "include": "#double_parentheses_types" 87 }, 88 { 89 "include": "#switch_types" 90 }, 91 { 92 "include": "#type-declarations" 93 } 94 ] 95 }, 96 "group-variables": { 97 "comment": "all statements related to variables", 98 "patterns": [ 99 { 100 "include": "#const_assignment" 101 }, 102 { 103 "include": "#var_assignment" 104 }, 105 { 106 "include": "#variable_assignment" 107 }, 108 { 109 "include": "#label_loop_variables" 110 }, 111 { 112 "include": "#slice_index_variables" 113 }, 114 { 115 "include": "#property_variables" 116 }, 117 { 118 "include": "#switch_variables" 119 }, 120 { 121 "include": "#other_variables" 122 } 123 ] 124 }, 125 "type-declarations": { 126 "comment": "includes all type declarations", 127 "patterns": [ 128 { 129 "include": "#language_constants" 130 }, 131 { 132 "include": "#comments" 133 }, 134 { 135 "include": "#map_types" 136 }, 137 { 138 "include": "#brackets" 139 }, 140 { 141 "include": "#delimiters" 142 }, 143 { 144 "include": "#keywords" 145 }, 146 { 147 "include": "#operators" 148 }, 149 { 150 "include": "#runes" 151 }, 152 { 153 "include": "#storage_types" 154 }, 155 { 156 "include": "#raw_string_literals" 157 }, 158 { 159 "include": "#string_literals" 160 }, 161 { 162 "include": "#numeric_literals" 163 }, 164 { 165 "include": "#terminators" 166 } 167 ] 168 }, 169 "type-declarations-without-brackets": { 170 "comment": "includes all type declarations without brackets (in some cases, brackets need to be captured manually)", 171 "patterns": [ 172 { 173 "include": "#language_constants" 174 }, 175 { 176 "include": "#comments" 177 }, 178 { 179 "include": "#map_types" 180 }, 181 { 182 "include": "#delimiters" 183 }, 184 { 185 "include": "#keywords" 186 }, 187 { 188 "include": "#operators" 189 }, 190 { 191 "include": "#runes" 192 }, 193 { 194 "include": "#storage_types" 195 }, 196 { 197 "include": "#raw_string_literals" 198 }, 199 { 200 "include": "#string_literals" 201 }, 202 { 203 "include": "#numeric_literals" 204 }, 205 { 206 "include": "#terminators" 207 } 208 ] 209 }, 210 "parameter-variable-types": { 211 "comment": "function and generic parameter types", 212 "patterns": [ 213 { 214 "match": "\\{", 215 "name": "punctuation.definition.begin.bracket.curly.go" 216 }, 217 { 218 "match": "\\}", 219 "name": "punctuation.definition.end.bracket.curly.go" 220 }, 221 { 222 "begin": "([\\w\\.\\*]+)?(\\[)", 223 "beginCaptures": { 224 "1": { 225 "patterns": [ 226 { 227 "include": "#type-declarations" 228 }, 229 { 230 "match": "\\w+", 231 "name": "entity.name.type.go" 232 } 233 ] 234 }, 235 "2": { 236 "name": "punctuation.definition.begin.bracket.square.go" 237 } 238 }, 239 "end": "\\]", 240 "endCaptures": { 241 "0": { 242 "name": "punctuation.definition.end.bracket.square.go" 243 } 244 }, 245 "patterns": [ 246 { 247 "include": "#generic_param_types" 248 } 249 ] 250 }, 251 { 252 "begin": "\\(", 253 "beginCaptures": { 254 "0": { 255 "name": "punctuation.definition.begin.bracket.round.go" 256 } 257 }, 258 "end": "\\)", 259 "endCaptures": { 260 "0": { 261 "name": "punctuation.definition.end.bracket.round.go" 262 } 263 }, 264 "patterns": [ 265 { 266 "include": "#function_param_types" 267 } 268 ] 269 } 270 ] 271 }, 272 "language_constants": { 273 "comment": "Language constants", 274 "match": "\\b(?:(true|false)|(nil)|(iota))\\b", 275 "captures": { 276 "1": { 277 "name": "constant.language.boolean.go" 278 }, 279 "2": { 280 "name": "constant.language.null.go" 281 }, 282 "3": { 283 "name": "constant.language.iota.go" 284 } 285 } 286 }, 287 "comments": { 288 "patterns": [ 289 { 290 "name": "comment.block.go", 291 "begin": "(\\/\\*)", 292 "beginCaptures": { 293 "1": { 294 "name": "punctuation.definition.comment.go" 295 } 296 }, 297 "end": "(\\*\\/)", 298 "endCaptures": { 299 "1": { 300 "name": "punctuation.definition.comment.go" 301 } 302 } 303 }, 304 { 305 "name": "comment.line.double-slash.go", 306 "begin": "(\\/\\/)", 307 "beginCaptures": { 308 "1": { 309 "name": "punctuation.definition.comment.go" 310 } 311 }, 312 "end": "(?:\\n|$)" 313 } 314 ] 315 }, 316 "map_types": { 317 "comment": "map types", 318 "begin": "(\\bmap\\b)(\\[)", 319 "beginCaptures": { 320 "1": { 321 "name": "keyword.map.go" 322 }, 323 "2": { 324 "name": "punctuation.definition.begin.bracket.square.go" 325 } 326 }, 327 "end": "(?:(\\])((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?!(?:[\\[\\]\\*]+)?\\b(?:func|struct|map)\\b)(?:[\\*\\[\\]]+)?(?:[\\w\\.]+)(?:\\[(?:(?:[\\w\\.\\*\\[\\]\\{\\}]+)(?:(?:\\,\\s*(?:[\\w\\.\\*\\[\\]\\{\\}]+))*))?\\])?)?)", 328 "endCaptures": { 329 "1": { 330 "name": "punctuation.definition.end.bracket.square.go" 331 }, 332 "2": { 333 "patterns": [ 334 { 335 "include": "#type-declarations-without-brackets" 336 }, 337 { 338 "match": "\\[", 339 "name": "punctuation.definition.begin.bracket.square.go" 340 }, 341 { 342 "match": "\\]", 343 "name": "punctuation.definition.end.bracket.square.go" 344 }, 345 { 346 "match": "\\w+", 347 "name": "entity.name.type.go" 348 } 349 ] 350 } 351 }, 352 "patterns": [ 353 { 354 "include": "#type-declarations-without-brackets" 355 }, 356 { 357 "include": "#parameter-variable-types" 358 }, 359 { 360 "include": "#functions" 361 }, 362 { 363 "match": "\\[", 364 "name": "punctuation.definition.begin.bracket.square.go" 365 }, 366 { 367 "match": "\\]", 368 "name": "punctuation.definition.end.bracket.square.go" 369 }, 370 { 371 "match": "\\{", 372 "name": "punctuation.definition.begin.bracket.curly.go" 373 }, 374 { 375 "match": "\\}", 376 "name": "punctuation.definition.end.bracket.curly.go" 377 }, 378 { 379 "match": "\\(", 380 "name": "punctuation.definition.begin.bracket.round.go" 381 }, 382 { 383 "match": "\\)", 384 "name": "punctuation.definition.end.bracket.round.go" 385 }, 386 { 387 "match": "\\w+", 388 "name": "entity.name.type.go" 389 } 390 ] 391 }, 392 "brackets": { 393 "patterns": [ 394 { 395 "begin": "\\{", 396 "beginCaptures": { 397 "0": { 398 "name": "punctuation.definition.begin.bracket.curly.go" 399 } 400 }, 401 "end": "\\}", 402 "endCaptures": { 403 "0": { 404 "name": "punctuation.definition.end.bracket.curly.go" 405 } 406 }, 407 "patterns": [ 408 { 409 "include": "$self" 410 } 411 ] 412 }, 413 { 414 "begin": "\\(", 415 "beginCaptures": { 416 "0": { 417 "name": "punctuation.definition.begin.bracket.round.go" 418 } 419 }, 420 "end": "\\)", 421 "endCaptures": { 422 "0": { 423 "name": "punctuation.definition.end.bracket.round.go" 424 } 425 }, 426 "patterns": [ 427 { 428 "include": "$self" 429 } 430 ] 431 }, 432 { 433 "begin": "\\[", 434 "beginCaptures": { 435 "0": { 436 "name": "punctuation.definition.begin.bracket.square.go" 437 } 438 }, 439 "end": "\\]", 440 "endCaptures": { 441 "0": { 442 "name": "punctuation.definition.end.bracket.square.go" 443 } 444 }, 445 "patterns": [ 446 { 447 "include": "$self" 448 } 449 ] 450 } 451 ] 452 }, 453 "delimiters": { 454 "patterns": [ 455 { 456 "match": "\\,", 457 "name": "punctuation.other.comma.go" 458 }, 459 { 460 "match": "\\.(?!\\.\\.)", 461 "name": "punctuation.other.period.go" 462 }, 463 { 464 "match": ":(?!=)", 465 "name": "punctuation.other.colon.go" 466 } 467 ] 468 }, 469 "keywords": { 470 "patterns": [ 471 { 472 "comment": "Flow control keywords", 473 "match": "\\b(break|case|continue|default|defer|else|fallthrough|for|go|goto|if|range|return|select|switch)\\b", 474 "name": "keyword.control.go" 475 }, 476 { 477 "match": "\\bchan\\b", 478 "name": "keyword.channel.go" 479 }, 480 { 481 "match": "\\bconst\\b", 482 "name": "keyword.const.go" 483 }, 484 { 485 "match": "\\bvar\\b", 486 "name": "keyword.var.go" 487 }, 488 { 489 "match": "\\bfunc\\b", 490 "name": "keyword.function.go" 491 }, 492 { 493 "match": "\\binterface\\b", 494 "name": "keyword.interface.go" 495 }, 496 { 497 "match": "\\bmap\\b", 498 "name": "keyword.map.go" 499 }, 500 { 501 "match": "\\bstruct\\b", 502 "name": "keyword.struct.go" 503 }, 504 { 505 "match": "\\bimport\\b", 506 "name": "keyword.control.import.go" 507 }, 508 { 509 "match": "\\btype\\b", 510 "name": "keyword.type.go" 511 } 512 ] 513 }, 514 "operators": { 515 "comment": "Note that the order here is very important!", 516 "patterns": [ 517 { 518 "match": "(?<!\\w)(?:\\*|\\&)+(?:(?!\\d)(?=(?:[\\w\\[\\]])|(?:\\<\\-)))", 519 "name": "keyword.operator.address.go" 520 }, 521 { 522 "match": "<\\-", 523 "name": "keyword.operator.channel.go" 524 }, 525 { 526 "match": "\\-\\-", 527 "name": "keyword.operator.decrement.go" 528 }, 529 { 530 "match": "\\+\\+", 531 "name": "keyword.operator.increment.go" 532 }, 533 { 534 "match": "(==|!=|<=|>=|<(?!<)|>(?!>))", 535 "name": "keyword.operator.comparison.go" 536 }, 537 { 538 "match": "(&&|\\|\\||!)", 539 "name": "keyword.operator.logical.go" 540 }, 541 { 542 "match": "(=|\\+=|\\-=|\\|=|\\^=|\\*=|/=|:=|%=|<<=|>>=|&\\^=|&=)", 543 "name": "keyword.operator.assignment.go" 544 }, 545 { 546 "match": "(\\+|\\-|\\*|/|%)", 547 "name": "keyword.operator.arithmetic.go" 548 }, 549 { 550 "match": "(&(?!\\^)|\\||\\^|&\\^|<<|>>|\\~)", 551 "name": "keyword.operator.arithmetic.bitwise.go" 552 }, 553 { 554 "match": "\\.\\.\\.", 555 "name": "keyword.operator.ellipsis.go" 556 } 557 ] 558 }, 559 "runes": { 560 "patterns": [ 561 { 562 "begin": "'", 563 "beginCaptures": { 564 "0": { 565 "name": "punctuation.definition.string.begin.go" 566 } 567 }, 568 "end": "'", 569 "endCaptures": { 570 "0": { 571 "name": "punctuation.definition.string.end.go" 572 } 573 }, 574 "name": "string.quoted.rune.go", 575 "patterns": [ 576 { 577 "match": "\\G(\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})|.)(?=')", 578 "name": "constant.other.rune.go" 579 }, 580 { 581 "match": "[^']+", 582 "name": "invalid.illegal.unknown-rune.go" 583 } 584 ] 585 } 586 ] 587 }, 588 "storage_types": { 589 "patterns": [ 590 { 591 "match": "\\bbool\\b", 592 "name": "storage.type.boolean.go" 593 }, 594 { 595 "match": "\\bbyte\\b", 596 "name": "storage.type.byte.go" 597 }, 598 { 599 "match": "\\berror\\b", 600 "name": "storage.type.error.go" 601 }, 602 { 603 "match": "\\b(complex(64|128)|float(32|64)|u?int(8|16|32|64)?)\\b", 604 "name": "storage.type.numeric.go" 605 }, 606 { 607 "match": "\\brune\\b", 608 "name": "storage.type.rune.go" 609 }, 610 { 611 "match": "\\bstring\\b", 612 "name": "storage.type.string.go" 613 }, 614 { 615 "match": "\\buintptr\\b", 616 "name": "storage.type.uintptr.go" 617 }, 618 { 619 "match": "\\bany\\b", 620 "name": "entity.name.type.any.go" 621 }, 622 { 623 "match": "\\bcomparable\\b", 624 "name": "entity.name.type.comparable.go" 625 } 626 ] 627 }, 628 "raw_string_literals": { 629 "comment": "Raw string literals", 630 "begin": "`", 631 "beginCaptures": { 632 "0": { 633 "name": "punctuation.definition.string.begin.go" 634 } 635 }, 636 "end": "`", 637 "endCaptures": { 638 "0": { 639 "name": "punctuation.definition.string.end.go" 640 } 641 }, 642 "name": "string.quoted.raw.go", 643 "patterns": [ 644 { 645 "include": "#string_placeholder" 646 } 647 ] 648 }, 649 "string_literals": { 650 "patterns": [ 651 { 652 "comment": "Interpreted string literals", 653 "begin": "\"", 654 "beginCaptures": { 655 "0": { 656 "name": "punctuation.definition.string.begin.go" 657 } 658 }, 659 "end": "\"", 660 "endCaptures": { 661 "0": { 662 "name": "punctuation.definition.string.end.go" 663 } 664 }, 665 "name": "string.quoted.double.go", 666 "patterns": [ 667 { 668 "include": "#string_escaped_char" 669 }, 670 { 671 "include": "#string_placeholder" 672 } 673 ] 674 } 675 ] 676 }, 677 "string_escaped_char": { 678 "patterns": [ 679 { 680 "match": "\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})", 681 "name": "constant.character.escape.go" 682 }, 683 { 684 "match": "\\\\[^0-7xuUabfnrtv\\'\"]", 685 "name": "invalid.illegal.unknown-escape.go" 686 } 687 ] 688 }, 689 "string_placeholder": { 690 "patterns": [ 691 { 692 "match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGspw]", 693 "name": "constant.other.placeholder.go" 694 } 695 ] 696 }, 697 "numeric_literals": { 698 "match": "(?<!\\w)\\.?\\d(?:(?:[0-9a-zA-Z_\\.])|(?<=[eEpP])[+-])*", 699 "captures": { 700 "0": { 701 "patterns": [ 702 { 703 "begin": "(?=.)", 704 "end": "(?:\\n|$)", 705 "patterns": [ 706 { 707 "match": "(?:(?:(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?:(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$)|\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|\\G((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?:(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))", 708 "captures": { 709 "1": { 710 "name": "constant.numeric.decimal.go", 711 "patterns": [ 712 { 713 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 714 "name": "punctuation.separator.constant.numeric.go" 715 } 716 ] 717 }, 718 "2": { 719 "name": "punctuation.separator.constant.numeric.go" 720 }, 721 "3": { 722 "name": "constant.numeric.decimal.point.go" 723 }, 724 "4": { 725 "name": "constant.numeric.decimal.go", 726 "patterns": [ 727 { 728 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 729 "name": "punctuation.separator.constant.numeric.go" 730 } 731 ] 732 }, 733 "5": { 734 "name": "punctuation.separator.constant.numeric.go" 735 }, 736 "6": { 737 "name": "keyword.other.unit.exponent.decimal.go" 738 }, 739 "7": { 740 "name": "keyword.operator.plus.exponent.decimal.go" 741 }, 742 "8": { 743 "name": "keyword.operator.minus.exponent.decimal.go" 744 }, 745 "9": { 746 "name": "constant.numeric.exponent.decimal.go", 747 "patterns": [ 748 { 749 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 750 "name": "punctuation.separator.constant.numeric.go" 751 } 752 ] 753 }, 754 "10": { 755 "name": "keyword.other.unit.imaginary.go" 756 }, 757 "11": { 758 "name": "constant.numeric.decimal.go", 759 "patterns": [ 760 { 761 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 762 "name": "punctuation.separator.constant.numeric.go" 763 } 764 ] 765 }, 766 "12": { 767 "name": "punctuation.separator.constant.numeric.go" 768 }, 769 "13": { 770 "name": "keyword.other.unit.exponent.decimal.go" 771 }, 772 "14": { 773 "name": "keyword.operator.plus.exponent.decimal.go" 774 }, 775 "15": { 776 "name": "keyword.operator.minus.exponent.decimal.go" 777 }, 778 "16": { 779 "name": "constant.numeric.exponent.decimal.go", 780 "patterns": [ 781 { 782 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 783 "name": "punctuation.separator.constant.numeric.go" 784 } 785 ] 786 }, 787 "17": { 788 "name": "keyword.other.unit.imaginary.go" 789 }, 790 "18": { 791 "name": "constant.numeric.decimal.point.go" 792 }, 793 "19": { 794 "name": "constant.numeric.decimal.go", 795 "patterns": [ 796 { 797 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 798 "name": "punctuation.separator.constant.numeric.go" 799 } 800 ] 801 }, 802 "20": { 803 "name": "punctuation.separator.constant.numeric.go" 804 }, 805 "21": { 806 "name": "keyword.other.unit.exponent.decimal.go" 807 }, 808 "22": { 809 "name": "keyword.operator.plus.exponent.decimal.go" 810 }, 811 "23": { 812 "name": "keyword.operator.minus.exponent.decimal.go" 813 }, 814 "24": { 815 "name": "constant.numeric.exponent.decimal.go", 816 "patterns": [ 817 { 818 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 819 "name": "punctuation.separator.constant.numeric.go" 820 } 821 ] 822 }, 823 "25": { 824 "name": "keyword.other.unit.imaginary.go" 825 }, 826 "26": { 827 "name": "keyword.other.unit.hexadecimal.go" 828 }, 829 "27": { 830 "name": "constant.numeric.hexadecimal.go", 831 "patterns": [ 832 { 833 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 834 "name": "punctuation.separator.constant.numeric.go" 835 } 836 ] 837 }, 838 "28": { 839 "name": "punctuation.separator.constant.numeric.go" 840 }, 841 "29": { 842 "name": "constant.numeric.hexadecimal.go" 843 }, 844 "30": { 845 "name": "constant.numeric.hexadecimal.go", 846 "patterns": [ 847 { 848 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 849 "name": "punctuation.separator.constant.numeric.go" 850 } 851 ] 852 }, 853 "31": { 854 "name": "punctuation.separator.constant.numeric.go" 855 }, 856 "32": { 857 "name": "keyword.other.unit.exponent.hexadecimal.go" 858 }, 859 "33": { 860 "name": "keyword.operator.plus.exponent.hexadecimal.go" 861 }, 862 "34": { 863 "name": "keyword.operator.minus.exponent.hexadecimal.go" 864 }, 865 "35": { 866 "name": "constant.numeric.exponent.hexadecimal.go", 867 "patterns": [ 868 { 869 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 870 "name": "punctuation.separator.constant.numeric.go" 871 } 872 ] 873 }, 874 "36": { 875 "name": "keyword.other.unit.imaginary.go" 876 }, 877 "37": { 878 "name": "keyword.other.unit.hexadecimal.go" 879 }, 880 "38": { 881 "name": "constant.numeric.hexadecimal.go", 882 "patterns": [ 883 { 884 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 885 "name": "punctuation.separator.constant.numeric.go" 886 } 887 ] 888 }, 889 "39": { 890 "name": "punctuation.separator.constant.numeric.go" 891 }, 892 "40": { 893 "name": "keyword.other.unit.exponent.hexadecimal.go" 894 }, 895 "41": { 896 "name": "keyword.operator.plus.exponent.hexadecimal.go" 897 }, 898 "42": { 899 "name": "keyword.operator.minus.exponent.hexadecimal.go" 900 }, 901 "43": { 902 "name": "constant.numeric.exponent.hexadecimal.go", 903 "patterns": [ 904 { 905 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 906 "name": "punctuation.separator.constant.numeric.go" 907 } 908 ] 909 }, 910 "44": { 911 "name": "keyword.other.unit.imaginary.go" 912 }, 913 "45": { 914 "name": "keyword.other.unit.hexadecimal.go" 915 }, 916 "46": { 917 "name": "constant.numeric.hexadecimal.go" 918 }, 919 "47": { 920 "name": "constant.numeric.hexadecimal.go", 921 "patterns": [ 922 { 923 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 924 "name": "punctuation.separator.constant.numeric.go" 925 } 926 ] 927 }, 928 "48": { 929 "name": "punctuation.separator.constant.numeric.go" 930 }, 931 "49": { 932 "name": "keyword.other.unit.exponent.hexadecimal.go" 933 }, 934 "50": { 935 "name": "keyword.operator.plus.exponent.hexadecimal.go" 936 }, 937 "51": { 938 "name": "keyword.operator.minus.exponent.hexadecimal.go" 939 }, 940 "52": { 941 "name": "constant.numeric.exponent.hexadecimal.go", 942 "patterns": [ 943 { 944 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 945 "name": "punctuation.separator.constant.numeric.go" 946 } 947 ] 948 }, 949 "53": { 950 "name": "keyword.other.unit.imaginary.go" 951 } 952 } 953 }, 954 { 955 "match": "(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$)|(\\G0[bB])_?([01](?:[01]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))|(\\G0[oO]?)_?((?:[0-7]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))+)(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))", 956 "captures": { 957 "1": { 958 "name": "constant.numeric.decimal.go", 959 "patterns": [ 960 { 961 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 962 "name": "punctuation.separator.constant.numeric.go" 963 } 964 ] 965 }, 966 "2": { 967 "name": "punctuation.separator.constant.numeric.go" 968 }, 969 "3": { 970 "name": "keyword.other.unit.imaginary.go" 971 }, 972 "4": { 973 "name": "keyword.other.unit.binary.go" 974 }, 975 "5": { 976 "name": "constant.numeric.binary.go", 977 "patterns": [ 978 { 979 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 980 "name": "punctuation.separator.constant.numeric.go" 981 } 982 ] 983 }, 984 "6": { 985 "name": "punctuation.separator.constant.numeric.go" 986 }, 987 "7": { 988 "name": "keyword.other.unit.imaginary.go" 989 }, 990 "8": { 991 "name": "keyword.other.unit.octal.go" 992 }, 993 "9": { 994 "name": "constant.numeric.octal.go", 995 "patterns": [ 996 { 997 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 998 "name": "punctuation.separator.constant.numeric.go" 999 } 1000 ] 1001 }, 1002 "10": { 1003 "name": "punctuation.separator.constant.numeric.go" 1004 }, 1005 "11": { 1006 "name": "keyword.other.unit.imaginary.go" 1007 }, 1008 "12": { 1009 "name": "keyword.other.unit.hexadecimal.go" 1010 }, 1011 "13": { 1012 "name": "constant.numeric.hexadecimal.go", 1013 "patterns": [ 1014 { 1015 "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", 1016 "name": "punctuation.separator.constant.numeric.go" 1017 } 1018 ] 1019 }, 1020 "14": { 1021 "name": "punctuation.separator.constant.numeric.go" 1022 }, 1023 "15": { 1024 "name": "keyword.other.unit.imaginary.go" 1025 } 1026 } 1027 }, 1028 { 1029 "match": "(?:(?:[0-9a-zA-Z_\\.])|(?<=[eEpP])[+-])+", 1030 "name": "invalid.illegal.constant.numeric.go" 1031 } 1032 ] 1033 } 1034 ] 1035 } 1036 } 1037 }, 1038 "terminators": { 1039 "comment": "Terminators", 1040 "match": ";", 1041 "name": "punctuation.terminator.go" 1042 }, 1043 "package_name": { 1044 "patterns": [ 1045 { 1046 "comment": "package name", 1047 "begin": "\\b(package)\\s+", 1048 "beginCaptures": { 1049 "1": { 1050 "name": "keyword.package.go" 1051 } 1052 }, 1053 "end": "(?!\\G)", 1054 "patterns": [ 1055 { 1056 "match": "\\d\\w*", 1057 "name": "invalid.illegal.identifier.go" 1058 }, 1059 { 1060 "match": "\\w+", 1061 "name": "entity.name.type.package.go" 1062 } 1063 ] 1064 } 1065 ] 1066 }, 1067 "import": { 1068 "comment": "import", 1069 "patterns": [ 1070 { 1071 "comment": "import", 1072 "begin": "\\b(import)\\s+", 1073 "beginCaptures": { 1074 "1": { 1075 "name": "keyword.control.import.go" 1076 } 1077 }, 1078 "end": "(?!\\G)", 1079 "patterns": [ 1080 { 1081 "include": "#imports" 1082 } 1083 ] 1084 } 1085 ] 1086 }, 1087 "imports": { 1088 "comment": "import package(s)", 1089 "patterns": [ 1090 { 1091 "match": "(\\s*[\\w\\.]+)?\\s*((\")([^\"]*)(\"))", 1092 "captures": { 1093 "1": { 1094 "patterns": [ 1095 { 1096 "include": "#delimiters" 1097 }, 1098 { 1099 "match": "\\w+", 1100 "name": "variable.other.import.go" 1101 } 1102 ] 1103 }, 1104 "2": { 1105 "name": "string.quoted.double.go" 1106 }, 1107 "3": { 1108 "name": "punctuation.definition.string.begin.go" 1109 }, 1110 "4": { 1111 "name": "entity.name.import.go" 1112 }, 1113 "5": { 1114 "name": "punctuation.definition.string.end.go" 1115 } 1116 } 1117 }, 1118 { 1119 "begin": "\\(", 1120 "beginCaptures": { 1121 "0": { 1122 "name": "punctuation.definition.imports.begin.bracket.round.go" 1123 } 1124 }, 1125 "end": "\\)", 1126 "endCaptures": { 1127 "0": { 1128 "name": "punctuation.definition.imports.end.bracket.round.go" 1129 } 1130 }, 1131 "patterns": [ 1132 { 1133 "include": "#comments" 1134 }, 1135 { 1136 "include": "#imports" 1137 } 1138 ] 1139 }, 1140 { 1141 "include": "$self" 1142 } 1143 ] 1144 }, 1145 "function_declaration": { 1146 "comment": "Function declarations", 1147 "begin": "(?:^(\\bfunc\\b)(?:\\s*(\\([^\\)]+\\)\\s*)?(?:(\\w+)(?=\\(|\\[))?))", 1148 "beginCaptures": { 1149 "1": { 1150 "name": "keyword.function.go" 1151 }, 1152 "2": { 1153 "patterns": [ 1154 { 1155 "begin": "\\(", 1156 "beginCaptures": { 1157 "0": { 1158 "name": "punctuation.definition.begin.bracket.round.go" 1159 } 1160 }, 1161 "end": "\\)", 1162 "endCaptures": { 1163 "0": { 1164 "name": "punctuation.definition.end.bracket.round.go" 1165 } 1166 }, 1167 "patterns": [ 1168 { 1169 "match": "(?:(\\w+(?:\\s+))?((?:[\\w\\.\\*]+)(?:\\[(?:(?:(?:[\\w\\.\\*]+)(?:\\,\\s+)?)+)?\\])?))", 1170 "captures": { 1171 "1": { 1172 "name": "variable.parameter.go" 1173 }, 1174 "2": { 1175 "patterns": [ 1176 { 1177 "include": "#type-declarations-without-brackets" 1178 }, 1179 { 1180 "include": "#parameter-variable-types" 1181 }, 1182 { 1183 "match": "\\w+", 1184 "name": "entity.name.type.go" 1185 } 1186 ] 1187 } 1188 } 1189 }, 1190 { 1191 "include": "$self" 1192 } 1193 ] 1194 } 1195 ] 1196 }, 1197 "3": { 1198 "patterns": [ 1199 { 1200 "match": "\\d\\w*", 1201 "name": "invalid.illegal.identifier.go" 1202 }, 1203 { 1204 "match": "\\w+", 1205 "name": "entity.name.function.go" 1206 } 1207 ] 1208 } 1209 }, 1210 "end": "(?:(?<=\\))\\s*((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?!(?:[\\[\\]\\*]+)?(?:\\bstruct\\b|\\binterface\\b))[\\w\\.\\-\\*\\[\\]]+)?\\s*(?=\\{))", 1211 "endCaptures": { 1212 "1": { 1213 "patterns": [ 1214 { 1215 "include": "#type-declarations-without-brackets" 1216 }, 1217 { 1218 "include": "#parameter-variable-types" 1219 }, 1220 { 1221 "match": "\\w+", 1222 "name": "entity.name.type.go" 1223 } 1224 ] 1225 } 1226 }, 1227 "patterns": [ 1228 { 1229 "begin": "\\(", 1230 "beginCaptures": { 1231 "0": { 1232 "name": "punctuation.definition.begin.bracket.round.go" 1233 } 1234 }, 1235 "end": "\\)", 1236 "endCaptures": { 1237 "0": { 1238 "name": "punctuation.definition.end.bracket.round.go" 1239 } 1240 }, 1241 "patterns": [ 1242 { 1243 "include": "#function_param_types" 1244 } 1245 ] 1246 }, 1247 { 1248 "begin": "([\\w\\.\\*]+)?(\\[)", 1249 "beginCaptures": { 1250 "1": { 1251 "patterns": [ 1252 { 1253 "include": "#type-declarations" 1254 }, 1255 { 1256 "match": "\\w+", 1257 "name": "entity.name.type.go" 1258 } 1259 ] 1260 }, 1261 "2": { 1262 "name": "punctuation.definition.begin.bracket.square.go" 1263 } 1264 }, 1265 "end": "\\]", 1266 "endCaptures": { 1267 "0": { 1268 "name": "punctuation.definition.end.bracket.square.go" 1269 } 1270 }, 1271 "patterns": [ 1272 { 1273 "include": "#generic_param_types" 1274 } 1275 ] 1276 }, 1277 { 1278 "comment": "single function as a type returned type(s) declaration", 1279 "match": "(?:(?<=\\))(?:\\s*)((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?[\\w\\*\\.\\[\\]\\<\\>\\-]+(?:\\s*)(?:\\/(?:\\/|\\*).*)?)$)", 1280 "captures": { 1281 "1": { 1282 "patterns": [ 1283 { 1284 "include": "#type-declarations-without-brackets" 1285 }, 1286 { 1287 "include": "#parameter-variable-types" 1288 }, 1289 { 1290 "match": "\\w+", 1291 "name": "entity.name.type.go" 1292 } 1293 ] 1294 } 1295 } 1296 }, 1297 { 1298 "include": "$self" 1299 } 1300 ] 1301 }, 1302 "function_param_types": { 1303 "comment": "function parameter variables and types", 1304 "patterns": [ 1305 { 1306 "include": "#struct_variables_types" 1307 }, 1308 { 1309 "include": "#interface_variables_types" 1310 }, 1311 { 1312 "include": "#type-declarations-without-brackets" 1313 }, 1314 { 1315 "comment": "struct/interface type declaration", 1316 "match": "((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)\\s+(?=(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b\\s*\\{)", 1317 "captures": { 1318 "1": { 1319 "patterns": [ 1320 { 1321 "include": "#type-declarations" 1322 }, 1323 { 1324 "match": "\\w+", 1325 "name": "variable.parameter.go" 1326 } 1327 ] 1328 } 1329 } 1330 }, 1331 { 1332 "comment": "multiple parameters one type -with multilines", 1333 "match": "(?:(?:(?<=\\()|^\\s*)((?:(?:\\b\\w+\\,\\s*)+)(?:/(?:/|\\*).*)?)$)", 1334 "captures": { 1335 "1": { 1336 "patterns": [ 1337 { 1338 "include": "#type-declarations" 1339 }, 1340 { 1341 "match": "\\w+", 1342 "name": "variable.parameter.go" 1343 } 1344 ] 1345 } 1346 } 1347 }, 1348 { 1349 "comment": "multiple params and types | multiple params one type | one param one type", 1350 "match": "(?:((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)(?:\\s+)((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:(?:(?:[\\w\\[\\]\\.\\*]+)?(?:(?:\\bfunc\\b\\((?:[^\\)]+)?\\))(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s*))+(?:(?:(?:[\\w\\*\\.\\[\\]]+)|(?:\\((?:[^\\)]+)?\\))))?)|(?:(?:[\\[\\]\\*]+)?[\\w\\*\\.]+(?:\\[(?:[^\\]]+)\\])?(?:[\\w\\.\\*]+)?)+)))", 1351 "captures": { 1352 "1": { 1353 "patterns": [ 1354 { 1355 "include": "#delimiters" 1356 }, 1357 { 1358 "match": "\\w+", 1359 "name": "variable.parameter.go" 1360 } 1361 ] 1362 }, 1363 "2": { 1364 "patterns": [ 1365 { 1366 "include": "#type-declarations-without-brackets" 1367 }, 1368 { 1369 "include": "#parameter-variable-types" 1370 }, 1371 { 1372 "match": "\\w+", 1373 "name": "entity.name.type.go" 1374 } 1375 ] 1376 } 1377 } 1378 }, 1379 { 1380 "begin": "([\\w\\.\\*]+)?(\\[)", 1381 "beginCaptures": { 1382 "1": { 1383 "patterns": [ 1384 { 1385 "include": "#type-declarations" 1386 }, 1387 { 1388 "match": "\\w+", 1389 "name": "entity.name.type.go" 1390 } 1391 ] 1392 }, 1393 "2": { 1394 "name": "punctuation.definition.begin.bracket.square.go" 1395 } 1396 }, 1397 "end": "\\]", 1398 "endCaptures": { 1399 "0": { 1400 "name": "punctuation.definition.end.bracket.square.go" 1401 } 1402 }, 1403 "patterns": [ 1404 { 1405 "include": "#generic_param_types" 1406 } 1407 ] 1408 }, 1409 { 1410 "begin": "\\(", 1411 "beginCaptures": { 1412 "0": { 1413 "name": "punctuation.definition.begin.bracket.round.go" 1414 } 1415 }, 1416 "end": "\\)", 1417 "endCaptures": { 1418 "0": { 1419 "name": "punctuation.definition.end.bracket.round.go" 1420 } 1421 }, 1422 "patterns": [ 1423 { 1424 "include": "#function_param_types" 1425 } 1426 ] 1427 }, 1428 { 1429 "comment": "other types", 1430 "match": "([\\w\\.]+)", 1431 "captures": { 1432 "1": { 1433 "patterns": [ 1434 { 1435 "include": "#type-declarations" 1436 }, 1437 { 1438 "match": "\\w+", 1439 "name": "entity.name.type.go" 1440 } 1441 ] 1442 } 1443 } 1444 }, 1445 { 1446 "include": "$self" 1447 } 1448 ] 1449 }, 1450 "generic_param_types": { 1451 "comment": "generic parameter variables and types", 1452 "patterns": [ 1453 { 1454 "include": "#struct_variables_types" 1455 }, 1456 { 1457 "include": "#interface_variables_types" 1458 }, 1459 { 1460 "include": "#type-declarations-without-brackets" 1461 }, 1462 { 1463 "comment": "struct/interface type declaration", 1464 "match": "((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)\\s+(?=(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b\\s*\\{)", 1465 "captures": { 1466 "1": { 1467 "patterns": [ 1468 { 1469 "include": "#type-declarations" 1470 }, 1471 { 1472 "match": "\\w+", 1473 "name": "variable.parameter.go" 1474 } 1475 ] 1476 } 1477 } 1478 }, 1479 { 1480 "comment": "multiple parameters one type -with multilines", 1481 "match": "(?:(?:(?<=\\()|^\\s*)((?:(?:\\b\\w+\\,\\s*)+)(?:/(?:/|\\*).*)?)$)", 1482 "captures": { 1483 "1": { 1484 "patterns": [ 1485 { 1486 "include": "#type-declarations" 1487 }, 1488 { 1489 "match": "\\w+", 1490 "name": "variable.parameter.go" 1491 } 1492 ] 1493 } 1494 } 1495 }, 1496 { 1497 "comment": "multiple params and types | multiple types one param", 1498 "match": "(?:((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)(?:\\s+)((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:(?:(?:[\\w\\[\\]\\.\\*]+)?(?:(?:\\bfunc\\b\\((?:[^\\)]+)?\\))(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s*))+(?:(?:(?:[\\w\\*\\.]+)|(?:\\((?:[^\\)]+)?\\))))?)|(?:(?:(?:[\\w\\*\\.\\~]+)|(?:\\[(?:(?:[\\w\\.\\*]+)?(?:\\[(?:[^\\]]+)?\\])?(?:\\,\\s+)?)+\\]))(?:[\\w\\.\\*]+)?)+)))", 1499 "captures": { 1500 "1": { 1501 "patterns": [ 1502 { 1503 "include": "#delimiters" 1504 }, 1505 { 1506 "match": "\\w+", 1507 "name": "variable.parameter.go" 1508 } 1509 ] 1510 }, 1511 "2": { 1512 "patterns": [ 1513 { 1514 "include": "#type-declarations-without-brackets" 1515 }, 1516 { 1517 "include": "#parameter-variable-types" 1518 }, 1519 { 1520 "match": "\\w+", 1521 "name": "entity.name.type.go" 1522 } 1523 ] 1524 }, 1525 "3": { 1526 "patterns": [ 1527 { 1528 "include": "#type-declarations" 1529 }, 1530 { 1531 "match": "\\w+", 1532 "name": "entity.name.type.go" 1533 } 1534 ] 1535 } 1536 } 1537 }, 1538 { 1539 "begin": "([\\w\\.\\*]+)?(\\[)", 1540 "beginCaptures": { 1541 "1": { 1542 "patterns": [ 1543 { 1544 "include": "#type-declarations" 1545 }, 1546 { 1547 "match": "\\w+", 1548 "name": "entity.name.type.go" 1549 } 1550 ] 1551 }, 1552 "2": { 1553 "name": "punctuation.definition.begin.bracket.square.go" 1554 } 1555 }, 1556 "end": "\\]", 1557 "endCaptures": { 1558 "0": { 1559 "name": "punctuation.definition.end.bracket.square.go" 1560 } 1561 }, 1562 "patterns": [ 1563 { 1564 "include": "#generic_param_types" 1565 } 1566 ] 1567 }, 1568 { 1569 "begin": "\\(", 1570 "beginCaptures": { 1571 "0": { 1572 "name": "punctuation.definition.begin.bracket.round.go" 1573 } 1574 }, 1575 "end": "\\)", 1576 "endCaptures": { 1577 "0": { 1578 "name": "punctuation.definition.end.bracket.round.go" 1579 } 1580 }, 1581 "patterns": [ 1582 { 1583 "include": "#function_param_types" 1584 } 1585 ] 1586 }, 1587 { 1588 "comment": "other types", 1589 "match": "\\b([\\w\\.]+)", 1590 "captures": { 1591 "1": { 1592 "patterns": [ 1593 { 1594 "include": "#type-declarations" 1595 }, 1596 { 1597 "match": "\\w+", 1598 "name": "entity.name.type.go" 1599 } 1600 ] 1601 } 1602 } 1603 }, 1604 { 1605 "include": "$self" 1606 } 1607 ] 1608 }, 1609 "functions": { 1610 "comment": "Functions", 1611 "begin": "(\\bfunc\\b)(?=\\()", 1612 "beginCaptures": { 1613 "1": { 1614 "name": "keyword.function.go" 1615 } 1616 }, 1617 "end": "(?:(?<=\\))(\\s*(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?((?:(?:\\s*(?:(?:[\\[\\]\\*]+)?[\\w\\.\\*]+)?(?:(?:\\[(?:(?:[\\w\\.\\*]+)?(?:\\[(?:[^\\]]+)?\\])?(?:\\,\\s+)?)+\\])|(?:\\((?:[^\\)]+)?\\)))?(?:[\\w\\.\\*]+)?)(?:\\s*)(?=\\{))|(?:\\s*(?:(?:(?:[\\[\\]\\*]+)?(?!\\bfunc\\b)(?:[\\w\\.\\*]+)(?:\\[(?:(?:[\\w\\.\\*]+)?(?:\\[(?:[^\\]]+)?\\])?(?:\\,\\s+)?)+\\])?(?:[\\w\\.\\*]+)?)|(?:\\((?:[^\\)]+)?\\)))))?)", 1618 "endCaptures": { 1619 "1": { 1620 "patterns": [ 1621 { 1622 "include": "#type-declarations" 1623 } 1624 ] 1625 }, 1626 "2": { 1627 "patterns": [ 1628 { 1629 "include": "#type-declarations-without-brackets" 1630 }, 1631 { 1632 "include": "#parameter-variable-types" 1633 }, 1634 { 1635 "match": "\\w+", 1636 "name": "entity.name.type.go" 1637 } 1638 ] 1639 } 1640 }, 1641 "patterns": [ 1642 { 1643 "include": "#parameter-variable-types" 1644 } 1645 ] 1646 }, 1647 "functions_inline": { 1648 "comment": "functions in-line with multi return types", 1649 "match": "(?:(\\bfunc\\b)((?:\\((?:[^/]*?)\\))(?:\\s+)(?:\\((?:[^/]*?)\\)))(?:\\s+)(?=\\{))", 1650 "captures": { 1651 "1": { 1652 "name": "keyword.function.go" 1653 }, 1654 "2": { 1655 "patterns": [ 1656 { 1657 "include": "#type-declarations-without-brackets" 1658 }, 1659 { 1660 "begin": "\\(", 1661 "beginCaptures": { 1662 "0": { 1663 "name": "punctuation.definition.begin.bracket.round.go" 1664 } 1665 }, 1666 "end": "\\)", 1667 "endCaptures": { 1668 "0": { 1669 "name": "punctuation.definition.end.bracket.round.go" 1670 } 1671 }, 1672 "patterns": [ 1673 { 1674 "include": "#function_param_types" 1675 }, 1676 { 1677 "include": "$self" 1678 } 1679 ] 1680 }, 1681 { 1682 "match": "\\[", 1683 "name": "punctuation.definition.begin.bracket.square.go" 1684 }, 1685 { 1686 "match": "\\]", 1687 "name": "punctuation.definition.end.bracket.square.go" 1688 }, 1689 { 1690 "match": "\\{", 1691 "name": "punctuation.definition.begin.bracket.curly.go" 1692 }, 1693 { 1694 "match": "\\}", 1695 "name": "punctuation.definition.end.bracket.curly.go" 1696 }, 1697 { 1698 "match": "\\w+", 1699 "name": "entity.name.type.go" 1700 } 1701 ] 1702 } 1703 } 1704 }, 1705 "support_functions": { 1706 "comment": "Support Functions", 1707 "match": "(?:(?:((?<=\\.)\\b\\w+)|(\\b\\w+))(?<brackets>\\[(?:[^\\[\\]]|\\g<brackets>)*\\])?(?=\\())", 1708 "captures": { 1709 "1": { 1710 "name": "entity.name.function.support.go" 1711 }, 1712 "2": { 1713 "patterns": [ 1714 { 1715 "include": "#type-declarations" 1716 }, 1717 { 1718 "match": "\\d\\w*", 1719 "name": "invalid.illegal.identifier.go" 1720 }, 1721 { 1722 "match": "\\w+", 1723 "name": "entity.name.function.support.go" 1724 } 1725 ] 1726 }, 1727 "3": { 1728 "patterns": [ 1729 { 1730 "include": "#type-declarations-without-brackets" 1731 }, 1732 { 1733 "match": "\\[", 1734 "name": "punctuation.definition.begin.bracket.square.go" 1735 }, 1736 { 1737 "match": "\\]", 1738 "name": "punctuation.definition.end.bracket.square.go" 1739 }, 1740 { 1741 "match": "\\{", 1742 "name": "punctuation.definition.begin.bracket.curly.go" 1743 }, 1744 { 1745 "match": "\\}", 1746 "name": "punctuation.definition.end.bracket.curly.go" 1747 }, 1748 { 1749 "match": "\\w+", 1750 "name": "entity.name.type.go" 1751 } 1752 ] 1753 } 1754 } 1755 }, 1756 "other_struct_interface_expressions": { 1757 "comment": "struct and interface expression in-line (before curly bracket)", 1758 "patterns": [ 1759 { 1760 "comment": "after control variables must be added exactly here, do not move it! (changing may not affect tests, so be careful!)", 1761 "include": "#after_control_variables" 1762 }, 1763 { 1764 "comment": "uses a named group to recursively match generic type with nested brackets, like 'Foo[A[B, C]]{}'", 1765 "match": "\\b(?!struct\\b|interface\\b)([\\w\\.]+)(?<brackets>\\[(?:[^\\[\\]]|\\g<brackets>)*\\])?(?=\\{)", 1766 "captures": { 1767 "1": { 1768 "patterns": [ 1769 { 1770 "include": "#type-declarations" 1771 }, 1772 { 1773 "match": "\\w+", 1774 "name": "entity.name.type.go" 1775 } 1776 ] 1777 }, 1778 "2": { 1779 "patterns": [ 1780 { 1781 "include": "#type-declarations-without-brackets" 1782 }, 1783 { 1784 "match": "\\[", 1785 "name": "punctuation.definition.begin.bracket.square.go" 1786 }, 1787 { 1788 "match": "\\]", 1789 "name": "punctuation.definition.end.bracket.square.go" 1790 }, 1791 { 1792 "match": "\\{", 1793 "name": "punctuation.definition.begin.bracket.curly.go" 1794 }, 1795 { 1796 "match": "\\}", 1797 "name": "punctuation.definition.end.bracket.curly.go" 1798 }, 1799 { 1800 "match": "\\w+", 1801 "name": "entity.name.type.go" 1802 } 1803 ] 1804 } 1805 } 1806 } 1807 ] 1808 }, 1809 "type_assertion_inline": { 1810 "comment": "struct/interface types in-line (type assertion) | switch type keyword", 1811 "match": "(?:(?<=\\.\\()(?:(\\btype\\b)|((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?(?:[\\w\\.]+)(?:\\[(?:(?:[\\w\\.\\*\\[\\]\\{\\}]+)(?:(?:\\,\\s*(?:[\\w\\.\\*\\[\\]\\{\\}]+))*))?\\])?))(?=\\)))", 1812 "captures": { 1813 "1": { 1814 "name": "keyword.type.go" 1815 }, 1816 "2": { 1817 "patterns": [ 1818 { 1819 "include": "#type-declarations-without-brackets" 1820 }, 1821 { 1822 "match": "\\(", 1823 "name": "punctuation.definition.begin.bracket.round.go" 1824 }, 1825 { 1826 "match": "\\)", 1827 "name": "punctuation.definition.end.bracket.round.go" 1828 }, 1829 { 1830 "match": "\\[", 1831 "name": "punctuation.definition.begin.bracket.square.go" 1832 }, 1833 { 1834 "match": "\\]", 1835 "name": "punctuation.definition.end.bracket.square.go" 1836 }, 1837 { 1838 "match": "\\{", 1839 "name": "punctuation.definition.begin.bracket.curly.go" 1840 }, 1841 { 1842 "match": "\\}", 1843 "name": "punctuation.definition.end.bracket.curly.go" 1844 }, 1845 { 1846 "match": "\\w+", 1847 "name": "entity.name.type.go" 1848 } 1849 ] 1850 } 1851 } 1852 }, 1853 "struct_variables_types": { 1854 "comment": "Struct variable type", 1855 "begin": "(\\bstruct\\b)\\s*(\\{)", 1856 "beginCaptures": { 1857 "1": { 1858 "name": "keyword.struct.go" 1859 }, 1860 "2": { 1861 "name": "punctuation.definition.begin.bracket.curly.go" 1862 } 1863 }, 1864 "patterns": [ 1865 { 1866 "include": "#struct_variables_types_fields" 1867 }, 1868 { 1869 "include": "$self" 1870 } 1871 ], 1872 "end": "\\}", 1873 "endCaptures": { 1874 "0": { 1875 "name": "punctuation.definition.end.bracket.curly.go" 1876 } 1877 } 1878 }, 1879 "struct_variables_types_fields": { 1880 "comment": "Struct variable type fields", 1881 "patterns": [ 1882 { 1883 "include": "#struct_variable_types_fields_multi" 1884 }, 1885 { 1886 "comment": "one line - single type", 1887 "match": "(?:(?<=\\{)\\s*((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\w\\.\\*\\[\\]]+))\\s*(?=\\}))", 1888 "captures": { 1889 "1": { 1890 "patterns": [ 1891 { 1892 "include": "#type-declarations" 1893 }, 1894 { 1895 "match": "\\w+", 1896 "name": "entity.name.type.go" 1897 } 1898 ] 1899 } 1900 } 1901 }, 1902 { 1903 "comment": "one line - property variables and types", 1904 "match": "(?:(?<=\\{)\\s*((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\w\\.\\*\\[\\]]+))\\s*(?=\\}))", 1905 "captures": { 1906 "1": { 1907 "patterns": [ 1908 { 1909 "include": "#type-declarations" 1910 }, 1911 { 1912 "match": "\\w+", 1913 "name": "variable.other.property.go" 1914 } 1915 ] 1916 }, 1917 "2": { 1918 "patterns": [ 1919 { 1920 "include": "#type-declarations" 1921 }, 1922 { 1923 "match": "\\w+", 1924 "name": "entity.name.type.go" 1925 } 1926 ] 1927 } 1928 } 1929 }, 1930 { 1931 "comment": "one line with semicolon(;) without formatting gofmt - single type | property variables and types", 1932 "match": "(?:(?<=\\{)((?:\\s*(?:(?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?(?:(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[^\\s/\\`\"]+)(?:\\;)?))+)\\s*(?=\\}))", 1933 "captures": { 1934 "1": { 1935 "patterns": [ 1936 { 1937 "match": "(?:((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[^\\s/\\`\"]+)(?:\\;)?))", 1938 "captures": { 1939 "1": { 1940 "patterns": [ 1941 { 1942 "include": "#type-declarations" 1943 }, 1944 { 1945 "match": "\\w+", 1946 "name": "variable.other.property.go" 1947 } 1948 ] 1949 }, 1950 "2": { 1951 "patterns": [ 1952 { 1953 "include": "#type-declarations" 1954 }, 1955 { 1956 "match": "\\w+", 1957 "name": "entity.name.type.go" 1958 } 1959 ] 1960 } 1961 } 1962 } 1963 ] 1964 } 1965 } 1966 }, 1967 { 1968 "comment": "one type only", 1969 "match": "(?:((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\w\\.\\*]+)\\s*)(?:(?=\\`|\\/|\")|$))", 1970 "captures": { 1971 "1": { 1972 "patterns": [ 1973 { 1974 "include": "#type-declarations" 1975 }, 1976 { 1977 "match": "\\w+", 1978 "name": "entity.name.type.go" 1979 } 1980 ] 1981 } 1982 } 1983 }, 1984 { 1985 "comment": "property variables and types", 1986 "match": "(\\b\\w+(?:\\s*\\,\\s*\\b\\w+)*)\\s*([^\\`\"\\/]+)", 1987 "captures": { 1988 "1": { 1989 "patterns": [ 1990 { 1991 "include": "#type-declarations" 1992 }, 1993 { 1994 "match": "\\w+", 1995 "name": "variable.other.property.go" 1996 } 1997 ] 1998 }, 1999 "2": { 2000 "patterns": [ 2001 { 2002 "include": "#type-declarations-without-brackets" 2003 }, 2004 { 2005 "include": "#parameter-variable-types" 2006 }, 2007 { 2008 "match": "\\w+", 2009 "name": "entity.name.type.go" 2010 } 2011 ] 2012 } 2013 } 2014 } 2015 ] 2016 }, 2017 "struct_variable_types_fields_multi": { 2018 "comment": "struct variable and type fields with multi lines", 2019 "patterns": [ 2020 { 2021 "comment": "struct in struct types", 2022 "begin": "(?:((?:\\b\\w+(?:\\,\\s*\\b\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s*)(?:[\\[\\]\\*]+)?)(\\bstruct\\b)(?:\\s*)(\\{))", 2023 "beginCaptures": { 2024 "1": { 2025 "patterns": [ 2026 { 2027 "include": "#type-declarations" 2028 }, 2029 { 2030 "match": "\\w+", 2031 "name": "variable.other.property.go" 2032 } 2033 ] 2034 }, 2035 "2": { 2036 "name": "keyword.struct.go" 2037 }, 2038 "3": { 2039 "name": "punctuation.definition.begin.bracket.curly.go" 2040 } 2041 }, 2042 "end": "\\}", 2043 "endCaptures": { 2044 "0": { 2045 "name": "punctuation.definition.end.bracket.curly.go" 2046 } 2047 }, 2048 "patterns": [ 2049 { 2050 "include": "#struct_variables_types_fields" 2051 }, 2052 { 2053 "include": "$self" 2054 } 2055 ] 2056 }, 2057 { 2058 "comment": "interface in struct types", 2059 "begin": "(?:((?:\\b\\w+(?:\\,\\s*\\b\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s*)(?:[\\[\\]\\*]+)?)(\\binterface\\b)(?:\\s*)(\\{))", 2060 "beginCaptures": { 2061 "1": { 2062 "patterns": [ 2063 { 2064 "include": "#type-declarations" 2065 }, 2066 { 2067 "match": "\\w+", 2068 "name": "variable.other.property.go" 2069 } 2070 ] 2071 }, 2072 "2": { 2073 "name": "keyword.interface.go" 2074 }, 2075 "3": { 2076 "name": "punctuation.definition.begin.bracket.curly.go" 2077 } 2078 }, 2079 "end": "\\}", 2080 "endCaptures": { 2081 "0": { 2082 "name": "punctuation.definition.end.bracket.curly.go" 2083 } 2084 }, 2085 "patterns": [ 2086 { 2087 "include": "#interface_variables_types_field" 2088 }, 2089 { 2090 "include": "$self" 2091 } 2092 ] 2093 }, 2094 { 2095 "comment": "function in struct types", 2096 "begin": "(?:((?:\\b\\w+(?:\\,\\s*\\b\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s*)(?:[\\[\\]\\*]+)?)(\\bfunc\\b)(?:\\s*)(\\())", 2097 "beginCaptures": { 2098 "1": { 2099 "patterns": [ 2100 { 2101 "include": "#type-declarations" 2102 }, 2103 { 2104 "match": "\\w+", 2105 "name": "variable.other.property.go" 2106 } 2107 ] 2108 }, 2109 "2": { 2110 "name": "keyword.function.go" 2111 }, 2112 "3": { 2113 "name": "punctuation.definition.begin.bracket.round.go" 2114 } 2115 }, 2116 "end": "\\)", 2117 "endCaptures": { 2118 "0": { 2119 "name": "punctuation.definition.end.bracket.round.go" 2120 } 2121 }, 2122 "patterns": [ 2123 { 2124 "include": "#function_param_types" 2125 }, 2126 { 2127 "include": "$self" 2128 } 2129 ] 2130 }, 2131 { 2132 "include": "#parameter-variable-types" 2133 } 2134 ] 2135 }, 2136 "interface_variables_types": { 2137 "comment": "interface variable types", 2138 "begin": "(\\binterface\\b)\\s*(\\{)", 2139 "beginCaptures": { 2140 "1": { 2141 "name": "keyword.interface.go" 2142 }, 2143 "2": { 2144 "name": "punctuation.definition.begin.bracket.curly.go" 2145 } 2146 }, 2147 "patterns": [ 2148 { 2149 "include": "#interface_variables_types_field" 2150 }, 2151 { 2152 "include": "$self" 2153 } 2154 ], 2155 "end": "\\}", 2156 "endCaptures": { 2157 "0": { 2158 "name": "punctuation.definition.end.bracket.curly.go" 2159 } 2160 } 2161 }, 2162 "interface_variables_types_field": { 2163 "comment": "interface variable type fields", 2164 "patterns": [ 2165 { 2166 "include": "#support_functions" 2167 }, 2168 { 2169 "include": "#type-declarations-without-brackets" 2170 }, 2171 { 2172 "begin": "([\\w\\.\\*]+)?(\\[)", 2173 "beginCaptures": { 2174 "1": { 2175 "patterns": [ 2176 { 2177 "include": "#type-declarations" 2178 }, 2179 { 2180 "match": "\\w+", 2181 "name": "entity.name.type.go" 2182 } 2183 ] 2184 }, 2185 "2": { 2186 "name": "punctuation.definition.begin.bracket.square.go" 2187 } 2188 }, 2189 "end": "\\]", 2190 "endCaptures": { 2191 "0": { 2192 "name": "punctuation.definition.end.bracket.square.go" 2193 } 2194 }, 2195 "patterns": [ 2196 { 2197 "include": "#generic_param_types" 2198 } 2199 ] 2200 }, 2201 { 2202 "begin": "\\(", 2203 "beginCaptures": { 2204 "0": { 2205 "name": "punctuation.definition.begin.bracket.round.go" 2206 } 2207 }, 2208 "end": "\\)", 2209 "endCaptures": { 2210 "0": { 2211 "name": "punctuation.definition.end.bracket.round.go" 2212 } 2213 }, 2214 "patterns": [ 2215 { 2216 "include": "#function_param_types" 2217 } 2218 ] 2219 }, 2220 { 2221 "comment": "other types", 2222 "match": "([\\w\\.]+)", 2223 "captures": { 2224 "1": { 2225 "patterns": [ 2226 { 2227 "include": "#type-declarations" 2228 }, 2229 { 2230 "match": "\\w+", 2231 "name": "entity.name.type.go" 2232 } 2233 ] 2234 } 2235 } 2236 } 2237 ] 2238 }, 2239 "single_type": { 2240 "patterns": [ 2241 { 2242 "comment": "single type declaration", 2243 "match": "(?:(?:^\\s*)(\\btype\\b)(?:\\s*)([\\w\\.\\*]+)(?:\\s+)(?!(?:\\=\\s*)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b)([\\s\\S]+))", 2244 "captures": { 2245 "1": { 2246 "name": "keyword.type.go" 2247 }, 2248 "2": { 2249 "patterns": [ 2250 { 2251 "include": "#type-declarations" 2252 }, 2253 { 2254 "match": "\\w+", 2255 "name": "entity.name.type.go" 2256 } 2257 ] 2258 }, 2259 "3": { 2260 "patterns": [ 2261 { 2262 "begin": "\\(", 2263 "beginCaptures": { 2264 "0": { 2265 "name": "punctuation.definition.begin.bracket.round.go" 2266 } 2267 }, 2268 "end": "\\)", 2269 "endCaptures": { 2270 "0": { 2271 "name": "punctuation.definition.end.bracket.round.go" 2272 } 2273 }, 2274 "patterns": [ 2275 { 2276 "include": "#function_param_types" 2277 }, 2278 { 2279 "include": "$self" 2280 } 2281 ] 2282 }, 2283 { 2284 "include": "#type-declarations" 2285 }, 2286 { 2287 "include": "#generic_types" 2288 }, 2289 { 2290 "match": "\\w+", 2291 "name": "entity.name.type.go" 2292 } 2293 ] 2294 } 2295 } 2296 }, 2297 { 2298 "comment": "single type declaration with generics", 2299 "begin": "(?:(?:^|\\s+)(\\btype\\b)(?:\\s*)([\\w\\.\\*]+)(?=\\[))", 2300 "beginCaptures": { 2301 "1": { 2302 "name": "keyword.type.go" 2303 }, 2304 "2": { 2305 "patterns": [ 2306 { 2307 "include": "#type-declarations-without-brackets" 2308 }, 2309 { 2310 "match": "\\w+", 2311 "name": "entity.name.type.go" 2312 } 2313 ] 2314 } 2315 }, 2316 "end": "(?:(?<=\\])((?:\\s+)(?:\\=\\s*)?(?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:(?!(?:[\\[\\]\\*]+)?(?:\\bstruct\\b|\\binterface\\b|\\bfunc\\b))[\\w\\.\\-\\*\\[\\]]+(?:\\,\\s*[\\w\\.\\[\\]\\*]+)*))?)", 2317 "endCaptures": { 2318 "1": { 2319 "patterns": [ 2320 { 2321 "include": "#type-declarations-without-brackets" 2322 }, 2323 { 2324 "match": "\\[", 2325 "name": "punctuation.definition.begin.bracket.square.go" 2326 }, 2327 { 2328 "match": "\\]", 2329 "name": "punctuation.definition.end.bracket.square.go" 2330 }, 2331 { 2332 "match": "\\w+", 2333 "name": "entity.name.type.go" 2334 } 2335 ] 2336 } 2337 }, 2338 "patterns": [ 2339 { 2340 "include": "#struct_variables_types" 2341 }, 2342 { 2343 "include": "#type-declarations-without-brackets" 2344 }, 2345 { 2346 "include": "#parameter-variable-types" 2347 }, 2348 { 2349 "match": "\\[", 2350 "name": "punctuation.definition.begin.bracket.square.go" 2351 }, 2352 { 2353 "match": "\\]", 2354 "name": "punctuation.definition.end.bracket.square.go" 2355 }, 2356 { 2357 "match": "\\{", 2358 "name": "punctuation.definition.begin.bracket.curly.go" 2359 }, 2360 { 2361 "match": "\\}", 2362 "name": "punctuation.definition.end.bracket.curly.go" 2363 }, 2364 { 2365 "match": "\\(", 2366 "name": "punctuation.definition.begin.bracket.round.go" 2367 }, 2368 { 2369 "match": "\\)", 2370 "name": "punctuation.definition.end.bracket.round.go" 2371 }, 2372 { 2373 "match": "\\w+", 2374 "name": "entity.name.type.go" 2375 } 2376 ] 2377 } 2378 ] 2379 }, 2380 "multi_types": { 2381 "comment": "multi type declaration", 2382 "begin": "(\\btype\\b)\\s*(\\()", 2383 "beginCaptures": { 2384 "1": { 2385 "name": "keyword.type.go" 2386 }, 2387 "2": { 2388 "name": "punctuation.definition.begin.bracket.round.go" 2389 } 2390 }, 2391 "patterns": [ 2392 { 2393 "include": "#struct_variables_types" 2394 }, 2395 { 2396 "include": "#interface_variables_types" 2397 }, 2398 { 2399 "include": "#type-declarations-without-brackets" 2400 }, 2401 { 2402 "include": "#parameter-variable-types" 2403 }, 2404 { 2405 "match": "\\w+", 2406 "name": "entity.name.type.go" 2407 } 2408 ], 2409 "end": "\\)", 2410 "endCaptures": { 2411 "0": { 2412 "name": "punctuation.definition.end.bracket.round.go" 2413 } 2414 } 2415 }, 2416 "after_control_variables": { 2417 "comment": "After control variables, to not highlight as a struct/interface (before formatting with gofmt)", 2418 "match": "(?:(?<=\\brange\\b|\\;|\\bif\\b|\\bfor\\b|\\<|\\>|\\<\\=|\\>\\=|\\=\\=|\\!\\=|\\w(?:\\+|/|\\-|\\*|\\%)|\\w(?:\\+|/|\\-|\\*|\\%)\\=|\\|\\||\\&\\&)(?:\\s*)((?![\\[\\]]+)[[:alnum:]\\-\\_\\!\\.\\[\\]\\<\\>\\=\\*/\\+\\%\\:]+)(?:\\s*)(?=\\{))", 2419 "captures": { 2420 "1": { 2421 "patterns": [ 2422 { 2423 "include": "#type-declarations-without-brackets" 2424 }, 2425 { 2426 "match": "\\[", 2427 "name": "punctuation.definition.begin.bracket.square.go" 2428 }, 2429 { 2430 "match": "\\]", 2431 "name": "punctuation.definition.end.bracket.square.go" 2432 }, 2433 { 2434 "match": "\\w+", 2435 "name": "variable.other.go" 2436 } 2437 ] 2438 } 2439 } 2440 }, 2441 "syntax_errors": { 2442 "patterns": [ 2443 { 2444 "comment": "Syntax error using slices", 2445 "match": "\\[\\](\\s+)", 2446 "captures": { 2447 "1": { 2448 "name": "invalid.illegal.slice.go" 2449 } 2450 } 2451 }, 2452 { 2453 "comment": "Syntax error numeric literals", 2454 "match": "\\b0[0-7]*[89]\\d*\\b", 2455 "name": "invalid.illegal.numeric.go" 2456 } 2457 ] 2458 }, 2459 "built_in_functions": { 2460 "comment": "Built-in functions", 2461 "patterns": [ 2462 { 2463 "match": "\\b(append|cap|close|complex|copy|delete|imag|len|panic|print|println|real|recover|min|max|clear)\\b(?=\\()", 2464 "name": "entity.name.function.support.builtin.go" 2465 }, 2466 { 2467 "comment": "new keyword", 2468 "begin": "(\\bnew\\b)(\\()", 2469 "beginCaptures": { 2470 "1": { 2471 "name": "entity.name.function.support.builtin.go" 2472 }, 2473 "2": { 2474 "name": "punctuation.definition.begin.bracket.round.go" 2475 } 2476 }, 2477 "end": "\\)", 2478 "endCaptures": { 2479 "0": { 2480 "name": "punctuation.definition.end.bracket.round.go" 2481 } 2482 }, 2483 "patterns": [ 2484 { 2485 "include": "#functions" 2486 }, 2487 { 2488 "include": "#struct_variables_types" 2489 }, 2490 { 2491 "include": "#support_functions" 2492 }, 2493 { 2494 "include": "#type-declarations" 2495 }, 2496 { 2497 "include": "#generic_types" 2498 }, 2499 { 2500 "match": "\\w+", 2501 "name": "entity.name.type.go" 2502 }, 2503 { 2504 "include": "$self" 2505 } 2506 ] 2507 }, 2508 { 2509 "comment": "make keyword", 2510 "begin": "(?:(\\bmake\\b)(?:(\\()((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?:[\\[\\]\\*]+)?(?:(?!\\bmap\\b)(?:[\\w\\.]+))?(\\[(?:(?:[\\S]+)(?:(?:\\,\\s*(?:[\\S]+))*))?\\])?(?:\\,)?)?))", 2511 "beginCaptures": { 2512 "1": { 2513 "name": "entity.name.function.support.builtin.go" 2514 }, 2515 "2": { 2516 "name": "punctuation.definition.begin.bracket.round.go" 2517 }, 2518 "3": { 2519 "patterns": [ 2520 { 2521 "include": "#type-declarations-without-brackets" 2522 }, 2523 { 2524 "include": "#parameter-variable-types" 2525 }, 2526 { 2527 "match": "\\w+", 2528 "name": "entity.name.type.go" 2529 } 2530 ] 2531 } 2532 }, 2533 "end": "\\)", 2534 "endCaptures": { 2535 "0": { 2536 "name": "punctuation.definition.end.bracket.round.go" 2537 } 2538 }, 2539 "patterns": [ 2540 { 2541 "include": "$self" 2542 } 2543 ] 2544 } 2545 ] 2546 }, 2547 "struct_interface_declaration": { 2548 "comment": "struct, interface type declarations (related to: struct_variables_types, interface_variables_types)", 2549 "match": "(?:(?:^\\s*)(\\btype\\b)(?:\\s*)([\\w\\.]+))", 2550 "captures": { 2551 "1": { 2552 "name": "keyword.type.go" 2553 }, 2554 "2": { 2555 "patterns": [ 2556 { 2557 "include": "#type-declarations" 2558 }, 2559 { 2560 "match": "\\w+", 2561 "name": "entity.name.type.go" 2562 } 2563 ] 2564 } 2565 } 2566 }, 2567 "switch_types": { 2568 "comment": "switch type assertions, only highlights types after case keyword", 2569 "begin": "(?<=\\bswitch\\b)(?:\\s*)(?:(\\w+\\s*\\:\\=)?\\s*([\\w\\.\\*\\(\\)\\[\\]\\+/\\-\\%\\<\\>\\|\\&]+))(\\.\\(\\btype\\b\\)\\s*)(\\{)", 2570 "beginCaptures": { 2571 "1": { 2572 "patterns": [ 2573 { 2574 "include": "#operators" 2575 }, 2576 { 2577 "match": "\\w+", 2578 "name": "variable.other.assignment.go" 2579 } 2580 ] 2581 }, 2582 "2": { 2583 "patterns": [ 2584 { 2585 "include": "#support_functions" 2586 }, 2587 { 2588 "include": "#type-declarations" 2589 }, 2590 { 2591 "match": "\\w+", 2592 "name": "variable.other.go" 2593 } 2594 ] 2595 }, 2596 "3": { 2597 "patterns": [ 2598 { 2599 "include": "#delimiters" 2600 }, 2601 { 2602 "include": "#brackets" 2603 }, 2604 { 2605 "match": "\\btype\\b", 2606 "name": "keyword.type.go" 2607 } 2608 ] 2609 }, 2610 "4": { 2611 "name": "punctuation.definition.begin.bracket.curly.go" 2612 } 2613 }, 2614 "end": "\\}", 2615 "endCaptures": { 2616 "0": { 2617 "name": "punctuation.definition.end.bracket.curly.go" 2618 } 2619 }, 2620 "patterns": [ 2621 { 2622 "comment": "types after case keyword with single line", 2623 "match": "(?:^\\s*(\\bcase\\b))(?:\\s+)([\\w\\.\\,\\*\\=\\<\\>\\!\\s]+)(:)(\\s*/(?:/|\\*)\\s*.*)?$", 2624 "captures": { 2625 "1": { 2626 "name": "keyword.control.go" 2627 }, 2628 "2": { 2629 "patterns": [ 2630 { 2631 "include": "#type-declarations" 2632 }, 2633 { 2634 "match": "\\w+", 2635 "name": "entity.name.type.go" 2636 } 2637 ] 2638 }, 2639 "3": { 2640 "name": "punctuation.other.colon.go" 2641 }, 2642 "4": { 2643 "patterns": [ 2644 { 2645 "include": "#comments" 2646 } 2647 ] 2648 } 2649 } 2650 }, 2651 { 2652 "comment": "types after case keyword with multi lines", 2653 "begin": "\\bcase\\b", 2654 "beginCaptures": { 2655 "0": { 2656 "name": "keyword.control.go" 2657 } 2658 }, 2659 "end": "\\:", 2660 "endCaptures": { 2661 "0": { 2662 "name": "punctuation.other.colon.go" 2663 } 2664 }, 2665 "patterns": [ 2666 { 2667 "include": "#type-declarations" 2668 }, 2669 { 2670 "match": "\\w+", 2671 "name": "entity.name.type.go" 2672 } 2673 ] 2674 }, 2675 { 2676 "include": "$self" 2677 } 2678 ] 2679 }, 2680 "switch_variables": { 2681 "comment": "variables after case control keyword in switch/select expression, to not scope them as property variables", 2682 "patterns": [ 2683 { 2684 "comment": "single line", 2685 "match": "(?:(?:^\\s*(\\bcase\\b))(?:\\s+)([\\s\\S]+(?:\\:)\\s*(?:/(?:/|\\*).*)?)$)", 2686 "captures": { 2687 "1": { 2688 "name": "keyword.control.go" 2689 }, 2690 "2": { 2691 "patterns": [ 2692 { 2693 "include": "#type-declarations" 2694 }, 2695 { 2696 "include": "#support_functions" 2697 }, 2698 { 2699 "include": "#variable_assignment" 2700 }, 2701 { 2702 "match": "\\w+", 2703 "name": "variable.other.go" 2704 } 2705 ] 2706 } 2707 } 2708 }, 2709 { 2710 "comment": "multi lines", 2711 "begin": "(?<=\\bswitch\\b)(?:\\s*)((?:[\\w\\.]+(?:\\s*(?:[\\:\\=\\!\\,\\+/\\-\\%\\<\\>\\|\\&]+)\\s*[\\w\\.]+)*\\s*(?:[\\:\\=\\!\\,\\+/\\-\\%\\<\\>\\|\\&]+))?(?:\\s*(?:[\\w\\.\\*\\(\\)\\[\\]\\+/\\-\\%\\<\\>\\|\\&]+)?\\s*(?:\\;\\s*(?:[\\w\\.\\*\\(\\)\\[\\]\\+/\\-\\%\\<\\>\\|\\&]+)\\s*)?))(\\{)", 2712 "beginCaptures": { 2713 "1": { 2714 "patterns": [ 2715 { 2716 "include": "#support_functions" 2717 }, 2718 { 2719 "include": "#type-declarations" 2720 }, 2721 { 2722 "include": "#variable_assignment" 2723 }, 2724 { 2725 "match": "\\w+", 2726 "name": "variable.other.go" 2727 } 2728 ] 2729 }, 2730 "2": { 2731 "name": "punctuation.definition.begin.bracket.curly.go" 2732 } 2733 }, 2734 "end": "\\}", 2735 "endCaptures": { 2736 "0": { 2737 "name": "punctuation.definition.end.bracket.curly.go" 2738 } 2739 }, 2740 "patterns": [ 2741 { 2742 "begin": "\\bcase\\b", 2743 "beginCaptures": { 2744 "0": { 2745 "name": "keyword.control.go" 2746 } 2747 }, 2748 "end": "\\:", 2749 "endCaptures": { 2750 "0": { 2751 "name": "punctuation.other.colon.go" 2752 } 2753 }, 2754 "patterns": [ 2755 { 2756 "include": "#support_functions" 2757 }, 2758 { 2759 "include": "#type-declarations" 2760 }, 2761 { 2762 "include": "#variable_assignment" 2763 }, 2764 { 2765 "match": "\\w+", 2766 "name": "variable.other.go" 2767 } 2768 ] 2769 }, 2770 { 2771 "include": "$self" 2772 } 2773 ] 2774 } 2775 ] 2776 }, 2777 "var_assignment": { 2778 "comment": "variable assignment with var keyword", 2779 "patterns": [ 2780 { 2781 "comment": "single assignment", 2782 "match": "(?:(?<=\\bvar\\b)(?:\\s*)(\\b[\\w\\.]+(?:\\,\\s*[\\w\\.]+)*)(?:\\s*)((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?!(?:[\\[\\]\\*]+)?\\b(?:struct|func|map)\\b)(?:[\\w\\.\\[\\]\\*]+(?:\\,\\s*[\\w\\.\\[\\]\\*]+)*)?(?:\\s*)(?:\\=)?)?)", 2783 "captures": { 2784 "1": { 2785 "patterns": [ 2786 { 2787 "include": "#delimiters" 2788 }, 2789 { 2790 "match": "\\w+", 2791 "name": "variable.other.assignment.go" 2792 } 2793 ] 2794 }, 2795 "2": { 2796 "patterns": [ 2797 { 2798 "include": "#type-declarations-without-brackets" 2799 }, 2800 { 2801 "include": "#generic_types" 2802 }, 2803 { 2804 "match": "\\(", 2805 "name": "punctuation.definition.begin.bracket.round.go" 2806 }, 2807 { 2808 "match": "\\)", 2809 "name": "punctuation.definition.end.bracket.round.go" 2810 }, 2811 { 2812 "match": "\\[", 2813 "name": "punctuation.definition.begin.bracket.square.go" 2814 }, 2815 { 2816 "match": "\\]", 2817 "name": "punctuation.definition.end.bracket.square.go" 2818 }, 2819 { 2820 "match": "\\w+", 2821 "name": "entity.name.type.go" 2822 } 2823 ] 2824 } 2825 } 2826 }, 2827 { 2828 "comment": "multi assignment", 2829 "begin": "(?:(?<=\\bvar\\b)(?:\\s*)(\\())", 2830 "beginCaptures": { 2831 "1": { 2832 "name": "punctuation.definition.begin.bracket.round.go" 2833 } 2834 }, 2835 "end": "\\)", 2836 "endCaptures": { 2837 "0": { 2838 "name": "punctuation.definition.end.bracket.round.go" 2839 } 2840 }, 2841 "patterns": [ 2842 { 2843 "match": "(?:(?:^\\s*)(\\b[\\w\\.]+(?:\\,\\s*[\\w\\.]+)*)(?:\\s*)((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?!(?:[\\[\\]\\*]+)?\\b(?:struct|func|map)\\b)(?:[\\w\\.\\[\\]\\*]+(?:\\,\\s*[\\w\\.\\[\\]\\*]+)*)?(?:\\s*)(?:\\=)?)?)", 2844 "captures": { 2845 "1": { 2846 "patterns": [ 2847 { 2848 "include": "#delimiters" 2849 }, 2850 { 2851 "match": "\\w+", 2852 "name": "variable.other.assignment.go" 2853 } 2854 ] 2855 }, 2856 "2": { 2857 "patterns": [ 2858 { 2859 "include": "#type-declarations-without-brackets" 2860 }, 2861 { 2862 "include": "#generic_types" 2863 }, 2864 { 2865 "match": "\\(", 2866 "name": "punctuation.definition.begin.bracket.round.go" 2867 }, 2868 { 2869 "match": "\\)", 2870 "name": "punctuation.definition.end.bracket.round.go" 2871 }, 2872 { 2873 "match": "\\[", 2874 "name": "punctuation.definition.begin.bracket.square.go" 2875 }, 2876 { 2877 "match": "\\]", 2878 "name": "punctuation.definition.end.bracket.square.go" 2879 }, 2880 { 2881 "match": "\\w+", 2882 "name": "entity.name.type.go" 2883 } 2884 ] 2885 } 2886 } 2887 }, 2888 { 2889 "include": "$self" 2890 } 2891 ] 2892 } 2893 ] 2894 }, 2895 "const_assignment": { 2896 "comment": "constant assignment with const keyword", 2897 "patterns": [ 2898 { 2899 "comment": "single assignment", 2900 "match": "(?:(?<=\\bconst\\b)(?:\\s*)(\\b[\\w\\.]+(?:\\,\\s*[\\w\\.]+)*)(?:\\s*)((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?!(?:[\\[\\]\\*]+)?\\b(?:struct|func|map)\\b)(?:[\\w\\.\\[\\]\\*]+(?:\\,\\s*[\\w\\.\\[\\]\\*]+)*)?(?:\\s*)(?:\\=)?)?)", 2901 "captures": { 2902 "1": { 2903 "patterns": [ 2904 { 2905 "include": "#delimiters" 2906 }, 2907 { 2908 "match": "\\w+", 2909 "name": "variable.other.constant.go" 2910 } 2911 ] 2912 }, 2913 "2": { 2914 "patterns": [ 2915 { 2916 "include": "#type-declarations-without-brackets" 2917 }, 2918 { 2919 "include": "#generic_types" 2920 }, 2921 { 2922 "match": "\\(", 2923 "name": "punctuation.definition.begin.bracket.round.go" 2924 }, 2925 { 2926 "match": "\\)", 2927 "name": "punctuation.definition.end.bracket.round.go" 2928 }, 2929 { 2930 "match": "\\[", 2931 "name": "punctuation.definition.begin.bracket.square.go" 2932 }, 2933 { 2934 "match": "\\]", 2935 "name": "punctuation.definition.end.bracket.square.go" 2936 }, 2937 { 2938 "match": "\\w+", 2939 "name": "entity.name.type.go" 2940 } 2941 ] 2942 } 2943 } 2944 }, 2945 { 2946 "comment": "multi assignment", 2947 "begin": "(?:(?<=\\bconst\\b)(?:\\s*)(\\())", 2948 "beginCaptures": { 2949 "1": { 2950 "name": "punctuation.definition.begin.bracket.round.go" 2951 } 2952 }, 2953 "end": "\\)", 2954 "endCaptures": { 2955 "0": { 2956 "name": "punctuation.definition.end.bracket.round.go" 2957 } 2958 }, 2959 "patterns": [ 2960 { 2961 "match": "(?:(?:^\\s*)(\\b[\\w\\.]+(?:\\,\\s*[\\w\\.]+)*)(?:\\s*)((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?!(?:[\\[\\]\\*]+)?\\b(?:struct|func|map)\\b)(?:[\\w\\.\\[\\]\\*]+(?:\\,\\s*[\\w\\.\\[\\]\\*]+)*)?(?:\\s*)(?:\\=)?)?)", 2962 "captures": { 2963 "1": { 2964 "patterns": [ 2965 { 2966 "include": "#delimiters" 2967 }, 2968 { 2969 "match": "\\w+", 2970 "name": "variable.other.constant.go" 2971 } 2972 ] 2973 }, 2974 "2": { 2975 "patterns": [ 2976 { 2977 "include": "#type-declarations-without-brackets" 2978 }, 2979 { 2980 "include": "#generic_types" 2981 }, 2982 { 2983 "match": "\\(", 2984 "name": "punctuation.definition.begin.bracket.round.go" 2985 }, 2986 { 2987 "match": "\\)", 2988 "name": "punctuation.definition.end.bracket.round.go" 2989 }, 2990 { 2991 "match": "\\[", 2992 "name": "punctuation.definition.begin.bracket.square.go" 2993 }, 2994 { 2995 "match": "\\]", 2996 "name": "punctuation.definition.end.bracket.square.go" 2997 }, 2998 { 2999 "match": "\\w+", 3000 "name": "entity.name.type.go" 3001 } 3002 ] 3003 } 3004 } 3005 }, 3006 { 3007 "include": "$self" 3008 } 3009 ] 3010 } 3011 ] 3012 }, 3013 "variable_assignment": { 3014 "comment": "variable assignment", 3015 "patterns": [ 3016 { 3017 "comment": "variable assignment with :=", 3018 "match": "\\b\\w+(?:\\,\\s*\\w+)*(?=\\s*:=)", 3019 "captures": { 3020 "0": { 3021 "patterns": [ 3022 { 3023 "include": "#delimiters" 3024 }, 3025 { 3026 "match": "\\d\\w*", 3027 "name": "invalid.illegal.identifier.go" 3028 }, 3029 { 3030 "match": "\\w+", 3031 "name": "variable.other.assignment.go" 3032 } 3033 ] 3034 } 3035 } 3036 }, 3037 { 3038 "comment": "variable assignment with =", 3039 "match": "\\b[\\w\\.\\*]+(?:\\,\\s*[\\w\\.\\*]+)*(?=\\s*=(?!=))", 3040 "captures": { 3041 "0": { 3042 "patterns": [ 3043 { 3044 "include": "#delimiters" 3045 }, 3046 { 3047 "include": "#operators" 3048 }, 3049 { 3050 "match": "\\d\\w*", 3051 "name": "invalid.illegal.identifier.go" 3052 }, 3053 { 3054 "match": "\\w+", 3055 "name": "variable.other.assignment.go" 3056 } 3057 ] 3058 } 3059 } 3060 } 3061 ] 3062 }, 3063 "generic_types": { 3064 "comment": "Generic support for all types", 3065 "match": "(?:([\\w\\.\\*]+)(\\[(?:[^\\]]+)?\\]))", 3066 "captures": { 3067 "1": { 3068 "patterns": [ 3069 { 3070 "include": "#type-declarations" 3071 }, 3072 { 3073 "match": "\\w+", 3074 "name": "entity.name.type.go" 3075 } 3076 ] 3077 }, 3078 "2": { 3079 "patterns": [ 3080 { 3081 "include": "#parameter-variable-types" 3082 } 3083 ] 3084 } 3085 } 3086 }, 3087 "slice_index_variables": { 3088 "comment": "slice index and capacity variables, to not scope them as property variables", 3089 "match": "(?<=\\w\\[)((?:(?:\\b[\\w\\.\\*\\+/\\-\\%\\<\\>\\|\\&]+\\:)|(?:\\:\\b[\\w\\.\\*\\+/\\-\\%\\<\\>\\|\\&]+))(?:\\b[\\w\\.\\*\\+/\\-\\%\\<\\>\\|\\&]+)?(?:\\:\\b[\\w\\.\\*\\+/\\-\\%\\<\\>\\|\\&]+)?)(?=\\])", 3090 "captures": { 3091 "1": { 3092 "patterns": [ 3093 { 3094 "include": "#type-declarations" 3095 }, 3096 { 3097 "match": "\\w+", 3098 "name": "variable.other.go" 3099 } 3100 ] 3101 } 3102 } 3103 }, 3104 "property_variables": { 3105 "comment": "Property variables in struct", 3106 "match": "((?:\\b[\\w\\.]+)(?:\\:(?!\\=)))", 3107 "captures": { 3108 "1": { 3109 "patterns": [ 3110 { 3111 "include": "#type-declarations" 3112 }, 3113 { 3114 "match": "\\w+", 3115 "name": "variable.other.property.go" 3116 } 3117 ] 3118 } 3119 } 3120 }, 3121 "label_loop_variables": { 3122 "comment": "labeled loop variable name", 3123 "match": "((?:^\\s*\\w+:\\s*$)|(?:^\\s*(?:\\bbreak\\b|\\bgoto\\b|\\bcontinue\\b)\\s+\\w+(?:\\s*/(?:/|\\*)\\s*.*)?$))", 3124 "captures": { 3125 "1": { 3126 "patterns": [ 3127 { 3128 "include": "#type-declarations" 3129 }, 3130 { 3131 "match": "\\w+", 3132 "name": "variable.other.label.go" 3133 } 3134 ] 3135 } 3136 } 3137 }, 3138 "double_parentheses_types": { 3139 "comment": "double parentheses types", 3140 "match": "(?:(?<!\\w)(\\((?:[\\[\\]\\*]+)?(?:[\\w\\.]+)(?:\\[(?:(?:[\\w\\.\\*\\[\\]\\{\\}]+)(?:(?:\\,\\s*(?:[\\w\\.\\*\\[\\]\\{\\}]+))*))?\\])?\\))(?=\\())", 3141 "captures": { 3142 "1": { 3143 "patterns": [ 3144 { 3145 "include": "#type-declarations-without-brackets" 3146 }, 3147 { 3148 "match": "\\(", 3149 "name": "punctuation.definition.begin.bracket.round.go" 3150 }, 3151 { 3152 "match": "\\)", 3153 "name": "punctuation.definition.end.bracket.round.go" 3154 }, 3155 { 3156 "match": "\\[", 3157 "name": "punctuation.definition.begin.bracket.square.go" 3158 }, 3159 { 3160 "match": "\\]", 3161 "name": "punctuation.definition.end.bracket.square.go" 3162 }, 3163 { 3164 "match": "\\{", 3165 "name": "punctuation.definition.begin.bracket.curly.go" 3166 }, 3167 { 3168 "match": "\\}", 3169 "name": "punctuation.definition.end.bracket.curly.go" 3170 }, 3171 { 3172 "match": "\\w+", 3173 "name": "entity.name.type.go" 3174 } 3175 ] 3176 } 3177 } 3178 }, 3179 "hover": { 3180 "comment": "hovering with the mouse", 3181 "patterns": [ 3182 { 3183 "comment": "struct field property and types when hovering with the mouse", 3184 "match": "(?:(?<=^\\bfield\\b)\\s+([\\w\\*\\.]+)\\s+([\\s\\S]+))", 3185 "captures": { 3186 "1": { 3187 "patterns": [ 3188 { 3189 "include": "#type-declarations" 3190 }, 3191 { 3192 "match": "\\w+", 3193 "name": "variable.other.property.go" 3194 } 3195 ] 3196 }, 3197 "2": { 3198 "patterns": [ 3199 { 3200 "match": "\\binvalid\\b\\s+\\btype\\b", 3201 "name": "invalid.field.go" 3202 }, 3203 { 3204 "include": "#type-declarations-without-brackets" 3205 }, 3206 { 3207 "include": "#parameter-variable-types" 3208 }, 3209 { 3210 "match": "\\w+", 3211 "name": "entity.name.type.go" 3212 } 3213 ] 3214 } 3215 } 3216 }, 3217 { 3218 "comment": "return types when hovering with the mouse", 3219 "match": "(?:(?<=^\\breturns\\b)\\s+([\\s\\S]+))", 3220 "captures": { 3221 "1": { 3222 "patterns": [ 3223 { 3224 "include": "#type-declarations-without-brackets" 3225 }, 3226 { 3227 "include": "#parameter-variable-types" 3228 }, 3229 { 3230 "match": "\\w+", 3231 "name": "entity.name.type.go" 3232 } 3233 ] 3234 } 3235 } 3236 } 3237 ] 3238 }, 3239 "other_variables": { 3240 "comment": "all other variables", 3241 "match": "\\w+", 3242 "name": "variable.other.go" 3243 } 3244 } 3245 }