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

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

1,507 lines 34.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "name": "razor",
3 "scopeName": "text.aspnetcorerazor",
4 "fileTypes": ["razor", "cshtml"],
5 "patterns": [
6 {
7 "include": "#razor-control-structures"
8 },
9 {
10 "include": "text.html.basic"
11 }
12 ],
13 "repository": {
14 "razor-control-structures": {
15 "patterns": [
16 {
17 "include": "#razor-comment"
18 },
19 {
20 "include": "#razor-codeblock"
21 },
22 {
23 "include": "#explicit-razor-expression"
24 },
25 {
26 "include": "#escaped-transition"
27 },
28 {
29 "include": "#directives"
30 },
31 {
32 "include": "#transitioned-csharp-control-structures"
33 },
34 {
35 "include": "#implicit-expression"
36 }
37 ]
38 },
39 "escaped-transition": {
40 "name": "constant.character.escape.razor.transition",
41 "match": "@@"
42 },
43 "transition": {
44 "match": "@",
45 "name": "keyword.control.cshtml.transition"
46 },
47 "razor-codeblock": {
48 "name": "meta.structure.razor.codeblock",
49 "begin": "(@)(\\{)",
50 "beginCaptures": {
51 "1": {
52 "patterns": [
53 {
54 "include": "#transition"
55 }
56 ]
57 },
58 "2": {
59 "name": "keyword.control.razor.directive.codeblock.open"
60 }
61 },
62 "contentName": "source.cs",
63 "patterns": [
64 {
65 "include": "#razor-codeblock-body"
66 }
67 ],
68 "end": "(\\})",
69 "endCaptures": {
70 "1": {
71 "name": "keyword.control.razor.directive.codeblock.close"
72 }
73 }
74 },
75 "razor-codeblock-body": {
76 "patterns": [
77 {
78 "include": "#text-tag"
79 },
80 {
81 "include": "#wellformed-html"
82 },
83 {
84 "include": "#razor-single-line-markup"
85 },
86 {
87 "include": "#razor-control-structures"
88 },
89 {
90 "include": "source.cs"
91 }
92 ]
93 },
94 "razor-single-line-markup": {
95 "match": "(\\@\\:)([^$]*)$",
96 "captures": {
97 "1": {
98 "name": "keyword.control.razor.singleLineMarkup"
99 },
100 "2": {
101 "patterns": [
102 {
103 "include": "#razor-control-structures"
104 },
105 {
106 "include": "text.html.basic"
107 }
108 ]
109 }
110 }
111 },
112 "text-tag": {
113 "begin": "(<text\\s*>)",
114 "beginCaptures": {
115 "1": {
116 "name": "keyword.control.cshtml.transition.textTag.open"
117 }
118 },
119 "patterns": [
120 {
121 "include": "#wellformed-html"
122 },
123 {
124 "include": "$self"
125 }
126 ],
127 "end": "(</text>)",
128 "endCaptures": {
129 "1": {
130 "name": "keyword.control.cshtml.transition.textTag.close"
131 }
132 }
133 },
134 "razor-comment": {
135 "name": "meta.comment.razor",
136 "begin": "(@)(\\*)",
137 "beginCaptures": {
138 "1": {
139 "patterns": [
140 {
141 "include": "#transition"
142 }
143 ]
144 },
145 "2": {
146 "name": "keyword.control.razor.comment.star"
147 }
148 },
149 "contentName": "comment.block.razor",
150 "end": "(\\*)(@)",
151 "endCaptures": {
152 "1": {
153 "name": "keyword.control.razor.comment.star"
154 },
155 "2": {
156 "patterns": [
157 {
158 "include": "#transition"
159 }
160 ]
161 }
162 }
163 },
164 "wellformed-html": {
165 "patterns": [
166 {
167 "include": "#void-tag"
168 },
169 {
170 "include": "#non-void-tag"
171 }
172 ]
173 },
174 "void-tag": {
175 "name": "meta.tag.structure.$3.void.html",
176 "begin": "(?i)(<)(!)?(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)(?=\\s|/?>)",
177 "beginCaptures": {
178 "1": {
179 "name": "punctuation.definition.tag.begin.html"
180 },
181 "2": {
182 "name": "constant.character.escape.razor.tagHelperOptOut"
183 },
184 "3": {
185 "name": "entity.name.tag.html"
186 }
187 },
188 "patterns": [
189 {
190 "include": "text.html.basic#attribute"
191 }
192 ],
193 "end": "/?>",
194 "endCaptures": {
195 "0": {
196 "name": "punctuation.definition.tag.end.html"
197 }
198 }
199 },
200 "non-void-tag": {
201 "begin": "(?=<(!)?([^/\\s>]+)(\\s|/?>))",
202 "end": "(</)(\\2)\\s*(>)|(/>)",
203 "endCaptures": {
204 "1": {
205 "name": "punctuation.definition.tag.begin.html"
206 },
207 "2": {
208 "name": "entity.name.tag.html"
209 },
210 "3": {
211 "name": "punctuation.definition.tag.end.html"
212 },
213 "4": {
214 "name": "punctuation.definition.tag.end.html"
215 }
216 },
217 "patterns": [
218 {
219 "begin": "(<)(!)?([^/\\s>]+)(?=\\s|/?>)",
220 "beginCaptures": {
221 "1": {
222 "name": "punctuation.definition.tag.begin.html"
223 },
224 "2": {
225 "name": "constant.character.escape.razor.tagHelperOptOut"
226 },
227 "3": {
228 "name": "entity.name.tag.html"
229 }
230 },
231 "end": "(?=/?>)",
232 "patterns": [
233 {
234 "include": "#razor-control-structures"
235 },
236 {
237 "include": "text.html.basic#attribute"
238 }
239 ]
240 },
241 {
242 "begin": ">",
243 "beginCaptures": {
244 "0": {
245 "name": "punctuation.definition.tag.end.html"
246 }
247 },
248 "end": "(?=</)",
249 "patterns": [
250 {
251 "include": "#wellformed-html"
252 },
253 {
254 "include": "$self"
255 }
256 ]
257 }
258 ]
259 },
260 "explicit-razor-expression": {
261 "name": "meta.expression.explicit.cshtml",
262 "begin": "(@)\\(",
263 "beginCaptures": {
264 "0": {
265 "name": "keyword.control.cshtml"
266 },
267 "1": {
268 "patterns": [
269 {
270 "include": "#transition"
271 }
272 ]
273 }
274 },
275 "patterns": [
276 {
277 "include": "source.cs#expression"
278 }
279 ],
280 "end": "\\)",
281 "endCaptures": {
282 "0": {
283 "name": "keyword.control.cshtml"
284 }
285 }
286 },
287 "implicit-expression": {
288 "name": "meta.expression.implicit.cshtml",
289 "contentName": "source.cs",
290 "begin": "(?<![[:alpha:][:alnum:]])(@)",
291 "beginCaptures": {
292 "1": {
293 "patterns": [
294 {
295 "include": "#transition"
296 }
297 ]
298 }
299 },
300 "patterns": [
301 {
302 "include": "#await-prefix"
303 },
304 {
305 "include": "#implicit-expression-body"
306 }
307 ],
308 "end": "(?=[\\s<>\\{\\}\\)\\]'\"])"
309 },
310 "implicit-expression-body": {
311 "patterns": [
312 {
313 "include": "#implicit-expression-invocation-start"
314 },
315 {
316 "include": "#implicit-expression-accessor-start"
317 }
318 ],
319 "end": "(?=[\\s<>\\{\\}\\)\\]'\"])"
320 },
321 "implicit-expression-invocation-start": {
322 "begin": "([_[:alpha:]][_[:alnum:]]*)(?=\\()",
323 "beginCaptures": {
324 "1": {
325 "name": "entity.name.function.cs"
326 }
327 },
328 "patterns": [
329 {
330 "include": "#implicit-expression-continuation"
331 }
332 ],
333 "end": "(?=[\\s<>\\{\\}\\)\\]'\"])"
334 },
335 "implicit-expression-accessor-start": {
336 "begin": "([_[:alpha:]][_[:alnum:]]*)",
337 "beginCaptures": {
338 "1": {
339 "name": "variable.other.object.cs"
340 }
341 },
342 "patterns": [
343 {
344 "include": "#implicit-expression-continuation"
345 }
346 ],
347 "end": "(?=[\\s<>\\{\\}\\)\\]'\"])"
348 },
349 "implicit-expression-continuation": {
350 "patterns": [
351 {
352 "include": "#balanced-parenthesis-csharp"
353 },
354 {
355 "include": "#balanced-brackets-csharp"
356 },
357 {
358 "include": "#implicit-expression-invocation"
359 },
360 {
361 "include": "#implicit-expression-accessor"
362 },
363 {
364 "include": "#implicit-expression-extension"
365 }
366 ],
367 "end": "(?=[\\s<>\\{\\}\\)\\]'\"])"
368 },
369 "implicit-expression-accessor": {
370 "match": "(?<=\\.)[_[:alpha:]][_[:alnum:]]*",
371 "name": "variable.other.object.property.cs"
372 },
373 "implicit-expression-invocation": {
374 "match": "(?<=\\.)[_[:alpha:]][_[:alnum:]]*(?=\\()",
375 "name": "entity.name.function.cs"
376 },
377 "implicit-expression-operator": {
378 "patterns": [
379 {
380 "include": "#implicit-expression-dot-operator"
381 },
382 {
383 "include": "#implicit-expression-null-conditional-operator"
384 },
385 {
386 "include": "#implicit-expression-null-forgiveness-operator"
387 }
388 ]
389 },
390 "implicit-expression-dot-operator": {
391 "match": "(\\.)(?=[_[:alpha:]][_[:alnum:]]*)",
392 "captures": {
393 "1": {
394 "name": "punctuation.accessor.cs"
395 }
396 }
397 },
398 "implicit-expression-null-conditional-operator": {
399 "match": "(\\?)(?=[.\\[])",
400 "captures": {
401 "1": {
402 "name": "keyword.operator.null-conditional.cs"
403 }
404 }
405 },
406 "implicit-expression-null-forgiveness-operator": {
407 "match": "(\\!)(?=(?:\\.[_[:alpha:]][_[:alnum:]]*)|\\?|[\\[\\(])",
408 "captures": {
409 "1": {
410 "name": "keyword.operator.logical.cs"
411 }
412 }
413 },
414 "balanced-parenthesis-csharp": {
415 "begin": "(\\()",
416 "beginCaptures": {
417 "1": {
418 "name": "punctuation.parenthesis.open.cs"
419 }
420 },
421 "name": "razor.test.balanced.parenthesis",
422 "patterns": [
423 {
424 "include": "source.cs"
425 }
426 ],
427 "end": "(\\))",
428 "endCaptures": {
429 "1": {
430 "name": "punctuation.parenthesis.close.cs"
431 }
432 }
433 },
434 "balanced-brackets-csharp": {
435 "begin": "(\\[)",
436 "beginCaptures": {
437 "1": {
438 "name": "punctuation.squarebracket.open.cs"
439 }
440 },
441 "name": "razor.test.balanced.brackets",
442 "patterns": [
443 {
444 "include": "source.cs"
445 }
446 ],
447 "end": "(\\])",
448 "endCaptures": {
449 "1": {
450 "name": "punctuation.squarebracket.close.cs"
451 }
452 }
453 },
454 "directives": {
455 "patterns": [
456 {
457 "include": "#code-directive"
458 },
459 {
460 "include": "#functions-directive"
461 },
462 {
463 "include": "#page-directive"
464 },
465 {
466 "include": "#addTagHelper-directive"
467 },
468 {
469 "include": "#removeTagHelper-directive"
470 },
471 {
472 "include": "#tagHelperPrefix-directive"
473 },
474 {
475 "include": "#model-directive"
476 },
477 {
478 "include": "#inherits-directive"
479 },
480 {
481 "include": "#implements-directive"
482 },
483 {
484 "include": "#namespace-directive"
485 },
486 {
487 "include": "#inject-directive"
488 },
489 {
490 "include": "#attribute-directive"
491 },
492 {
493 "include": "#section-directive"
494 },
495 {
496 "include": "#layout-directive"
497 },
498 {
499 "include": "#using-directive"
500 }
501 ]
502 },
503 "code-directive": {
504 "begin": "(@)(code)\\s*",
505 "beginCaptures": {
506 "1": {
507 "patterns": [
508 {
509 "include": "#transition"
510 }
511 ]
512 },
513 "2": {
514 "name": "keyword.control.razor.directive.code"
515 }
516 },
517 "patterns": [
518 {
519 "include": "#directive-codeblock"
520 }
521 ],
522 "end": "(?<=})|\\s"
523 },
524 "functions-directive": {
525 "begin": "(@)(functions)\\s*",
526 "beginCaptures": {
527 "1": {
528 "patterns": [
529 {
530 "include": "#transition"
531 }
532 ]
533 },
534 "2": {
535 "name": "keyword.control.razor.directive.functions"
536 }
537 },
538 "patterns": [
539 {
540 "include": "#directive-codeblock"
541 }
542 ],
543 "end": "(?<=})|\\s"
544 },
545 "directive-codeblock": {
546 "begin": "(\\{)",
547 "beginCaptures": {
548 "1": {
549 "name": "keyword.control.razor.directive.codeblock.open"
550 }
551 },
552 "name": "meta.structure.razor.directive.codeblock",
553 "contentName": "source.cs",
554 "patterns": [
555 {
556 "include": "source.cs"
557 }
558 ],
559 "end": "(\\})",
560 "endCaptures": {
561 "1": {
562 "name": "keyword.control.razor.directive.codeblock.close"
563 }
564 }
565 },
566 "page-directive": {
567 "name": "meta.directive",
568 "match": "(@)(page)\\s+([^$]+)?",
569 "captures": {
570 "1": {
571 "patterns": [
572 {
573 "include": "#transition"
574 }
575 ]
576 },
577 "2": {
578 "name": "keyword.control.razor.directive.page"
579 },
580 "3": {
581 "patterns": [
582 {
583 "include": "source.cs#string-literal"
584 }
585 ]
586 }
587 }
588 },
589 "addTagHelper-directive": {
590 "name": "meta.directive",
591 "match": "(@)(addTagHelper)\\s+([^$]+)?",
592 "captures": {
593 "1": {
594 "patterns": [
595 {
596 "include": "#transition"
597 }
598 ]
599 },
600 "2": {
601 "name": "keyword.control.razor.directive.addTagHelper"
602 },
603 "3": {
604 "patterns": [
605 {
606 "include": "#tagHelper-directive-argument"
607 }
608 ]
609 }
610 }
611 },
612 "removeTagHelper-directive": {
613 "name": "meta.directive",
614 "match": "(@)(removeTagHelper)\\s+([^$]+)?",
615 "captures": {
616 "1": {
617 "patterns": [
618 {
619 "include": "#transition"
620 }
621 ]
622 },
623 "2": {
624 "name": "keyword.control.razor.directive.removeTagHelper"
625 },
626 "3": {
627 "patterns": [
628 {
629 "include": "#tagHelper-directive-argument"
630 }
631 ]
632 }
633 }
634 },
635 "tagHelperPrefix-directive": {
636 "name": "meta.directive",
637 "match": "(@)(tagHelperPrefix)\\s+([^$]+)?",
638 "captures": {
639 "1": {
640 "patterns": [
641 {
642 "include": "#transition"
643 }
644 ]
645 },
646 "2": {
647 "name": "keyword.control.razor.directive.tagHelperPrefix"
648 },
649 "3": {
650 "patterns": [
651 {
652 "include": "#tagHelper-directive-argument"
653 }
654 ]
655 }
656 }
657 },
658 "tagHelper-directive-argument": {
659 "patterns": [
660 {
661 "include": "source.cs#string-literal"
662 },
663 {
664 "include": "#unquoted-string-argument"
665 }
666 ]
667 },
668 "unquoted-string-argument": {
669 "name": "string.quoted.double.cs",
670 "match": "[^$]+"
671 },
672 "model-directive": {
673 "name": "meta.directive",
674 "match": "(@)(model)\\s+([^$]+)?",
675 "captures": {
676 "1": {
677 "patterns": [
678 {
679 "include": "#transition"
680 }
681 ]
682 },
683 "2": {
684 "name": "keyword.control.razor.directive.model"
685 },
686 "3": {
687 "patterns": [
688 {
689 "include": "source.cs#type"
690 }
691 ]
692 }
693 }
694 },
695 "inherits-directive": {
696 "name": "meta.directive",
697 "match": "(@)(inherits)\\s+([^$]+)?",
698 "captures": {
699 "1": {
700 "patterns": [
701 {
702 "include": "#transition"
703 }
704 ]
705 },
706 "2": {
707 "name": "keyword.control.razor.directive.inherits"
708 },
709 "3": {
710 "patterns": [
711 {
712 "include": "source.cs#type"
713 }
714 ]
715 }
716 }
717 },
718 "implements-directive": {
719 "name": "meta.directive",
720 "match": "(@)(implements)\\s+([^$]+)?",
721 "captures": {
722 "1": {
723 "patterns": [
724 {
725 "include": "#transition"
726 }
727 ]
728 },
729 "2": {
730 "name": "keyword.control.razor.directive.implements"
731 },
732 "3": {
733 "patterns": [
734 {
735 "include": "source.cs#type"
736 }
737 ]
738 }
739 }
740 },
741 "layout-directive": {
742 "name": "meta.directive",
743 "match": "(@)(layout)\\s+([^$]+)?",
744 "captures": {
745 "1": {
746 "patterns": [
747 {
748 "include": "#transition"
749 }
750 ]
751 },
752 "2": {
753 "name": "keyword.control.razor.directive.layout"
754 },
755 "3": {
756 "patterns": [
757 {
758 "include": "source.cs#type"
759 }
760 ]
761 }
762 }
763 },
764 "namespace-directive": {
765 "name": "meta.directive",
766 "match": "(@)(namespace)\\s+([^\\s]+)?",
767 "captures": {
768 "1": {
769 "patterns": [
770 {
771 "include": "#transition"
772 }
773 ]
774 },
775 "2": {
776 "name": "keyword.control.razor.directive.namespace"
777 },
778 "3": {
779 "patterns": [
780 {
781 "include": "#namespace-directive-argument"
782 }
783 ]
784 }
785 }
786 },
787 "namespace-directive-argument": {
788 "match": "([_[:alpha:]][_[:alnum:]]*)(\\.)?",
789 "captures": {
790 "1": {
791 "name": "entity.name.type.namespace.cs"
792 },
793 "2": {
794 "name": "punctuation.accessor.cs"
795 }
796 }
797 },
798 "inject-directive": {
799 "name": "meta.directive",
800 "match": "(@)(inject)\\s*([\\S\\s]+?)?\\s*([_[:alpha:]][_[:alnum:]]*)?\\s*(?=$)",
801 "captures": {
802 "1": {
803 "patterns": [
804 {
805 "include": "#transition"
806 }
807 ]
808 },
809 "2": {
810 "name": "keyword.control.razor.directive.inject"
811 },
812 "3": {
813 "patterns": [
814 {
815 "include": "source.cs#type"
816 }
817 ]
818 },
819 "4": {
820 "name": "entity.name.variable.property.cs"
821 }
822 }
823 },
824 "attribute-directive": {
825 "name": "meta.directive",
826 "begin": "(@)(attribute)\\b\\s+",
827 "beginCaptures": {
828 "1": {
829 "patterns": [
830 {
831 "include": "#transition"
832 }
833 ]
834 },
835 "2": {
836 "name": "keyword.control.razor.directive.attribute"
837 }
838 },
839 "patterns": [
840 {
841 "include": "source.cs#attribute-section"
842 }
843 ],
844 "end": "(?<=\\])|$"
845 },
846 "section-directive": {
847 "name": "meta.directive.block",
848 "begin": "(@)(section)\\b\\s+([_[:alpha:]][_[:alnum:]]*)?",
849 "beginCaptures": {
850 "1": {
851 "patterns": [
852 {
853 "include": "#transition"
854 }
855 ]
856 },
857 "2": {
858 "name": "keyword.control.razor.directive.section"
859 },
860 "3": {
861 "name": "variable.other.razor.directive.sectionName"
862 }
863 },
864 "patterns": [
865 {
866 "include": "#directive-markupblock"
867 }
868 ],
869 "end": "(?<=})"
870 },
871 "directive-markupblock": {
872 "name": "meta.structure.razor.directive.markblock",
873 "begin": "(\\{)",
874 "beginCaptures": {
875 "1": {
876 "name": "keyword.control.razor.directive.codeblock.open"
877 }
878 },
879 "patterns": [
880 {
881 "include": "$self"
882 }
883 ],
884 "end": "(\\})",
885 "endCaptures": {
886 "1": {
887 "name": "keyword.control.razor.directive.codeblock.close"
888 }
889 }
890 },
891 "using-directive": {
892 "name": "meta.directive",
893 "match": "(@)(using)\\b\\s+(?!\\(|\\s)(.+?)?(;)?$",
894 "captures": {
895 "1": {
896 "patterns": [
897 {
898 "include": "#transition"
899 }
900 ]
901 },
902 "2": {
903 "name": "keyword.other.using.cs"
904 },
905 "3": {
906 "patterns": [
907 {
908 "include": "#using-static-directive"
909 },
910 {
911 "include": "#using-alias-directive"
912 },
913 {
914 "include": "#using-standard-directive"
915 }
916 ]
917 },
918 "4": {
919 "name": "keyword.control.razor.optionalSemicolon"
920 }
921 }
922 },
923 "using-static-directive": {
924 "match": "(static)\\b\\s+(.+)",
925 "captures": {
926 "1": {
927 "name": "keyword.other.static.cs"
928 },
929 "2": {
930 "patterns": [
931 {
932 "include": "source.cs#type"
933 }
934 ]
935 }
936 }
937 },
938 "using-alias-directive": {
939 "match": "([_[:alpha:]][_[:alnum:]]*)\\b\\s*(=)\\s*(.+)\\s*",
940 "captures": {
941 "1": {
942 "name": "entity.name.type.alias.cs"
943 },
944 "2": {
945 "name": "keyword.operator.assignment.cs"
946 },
947 "3": {
948 "patterns": [
949 {
950 "include": "source.cs#type"
951 }
952 ]
953 }
954 }
955 },
956 "using-standard-directive": {
957 "match": "([_[:alpha:]][_[:alnum:]]*)\\s*",
958 "captures": {
959 "1": {
960 "name": "entity.name.type.namespace.cs"
961 }
962 }
963 },
964 "transitioned-csharp-control-structures": {
965 "patterns": [
966 {
967 "include": "#using-statement"
968 },
969 {
970 "include": "#if-statement"
971 },
972 {
973 "include": "#else-part"
974 },
975 {
976 "include": "#foreach-statement"
977 },
978 {
979 "include": "#for-statement"
980 },
981 {
982 "include": "#while-statement"
983 },
984 {
985 "include": "#switch-statement"
986 },
987 {
988 "include": "#lock-statement"
989 },
990 {
991 "include": "#do-statement"
992 },
993 {
994 "include": "#try-statement"
995 }
996 ]
997 },
998 "using-statement": {
999 "name": "meta.statement.using.razor",
1000 "begin": "(?:^\\s*|(@))(using)\\b\\s*(?=\\()",
1001 "beginCaptures": {
1002 "1": {
1003 "patterns": [
1004 {
1005 "include": "#transition"
1006 }
1007 ]
1008 },
1009 "2": {
1010 "name": "keyword.other.using.cs"
1011 }
1012 },
1013 "patterns": [
1014 {
1015 "include": "#csharp-condition"
1016 },
1017 {
1018 "include": "#csharp-code-block"
1019 },
1020 {
1021 "include": "#razor-codeblock-body"
1022 }
1023 ],
1024 "end": "(?<=})"
1025 },
1026 "if-statement": {
1027 "name": "meta.statement.if.razor",
1028 "begin": "(?:^\\s*|(@))(if)\\b\\s*(?=\\()",
1029 "beginCaptures": {
1030 "1": {
1031 "patterns": [
1032 {
1033 "include": "#transition"
1034 }
1035 ]
1036 },
1037 "2": {
1038 "name": "keyword.control.conditional.if.cs"
1039 }
1040 },
1041 "patterns": [
1042 {
1043 "include": "#csharp-condition"
1044 },
1045 {
1046 "include": "#csharp-code-block"
1047 },
1048 {
1049 "include": "#razor-codeblock-body"
1050 }
1051 ],
1052 "end": "(?<=})"
1053 },
1054 "else-part": {
1055 "name": "meta.statement.else.razor",
1056 "begin": "(?:^|(?<=}))\\s*(else)\\b\\s*?(?: (if))?\\s*?(?=[\\n\\(\\{])",
1057 "beginCaptures": {
1058 "1": {
1059 "name": "keyword.control.conditional.else.cs"
1060 },
1061 "2": {
1062 "name": "keyword.control.conditional.if.cs"
1063 }
1064 },
1065 "patterns": [
1066 {
1067 "include": "#csharp-condition"
1068 },
1069 {
1070 "include": "#csharp-code-block"
1071 },
1072 {
1073 "include": "#razor-codeblock-body"
1074 }
1075 ],
1076 "end": "(?<=})"
1077 },
1078 "for-statement": {
1079 "name": "meta.statement.for.razor",
1080 "begin": "(?:^\\s*|(@))(for)\\b\\s*(?=\\()",
1081 "beginCaptures": {
1082 "1": {
1083 "patterns": [
1084 {
1085 "include": "#transition"
1086 }
1087 ]
1088 },
1089 "2": {
1090 "name": "keyword.control.loop.for.cs"
1091 }
1092 },
1093 "patterns": [
1094 {
1095 "include": "#csharp-condition"
1096 },
1097 {
1098 "include": "#csharp-code-block"
1099 },
1100 {
1101 "include": "#razor-codeblock-body"
1102 }
1103 ],
1104 "end": "(?<=})"
1105 },
1106 "foreach-statement": {
1107 "name": "meta.statement.foreach.razor",
1108 "begin": "(?:^\\s*|(@)(await\\s+)?)(foreach)\\b\\s*(?=\\()",
1109 "beginCaptures": {
1110 "1": {
1111 "patterns": [
1112 {
1113 "include": "#transition"
1114 }
1115 ]
1116 },
1117 "2": {
1118 "patterns": [
1119 {
1120 "include": "#await-prefix"
1121 }
1122 ]
1123 },
1124 "3": {
1125 "name": "keyword.control.loop.foreach.cs"
1126 }
1127 },
1128 "patterns": [
1129 {
1130 "include": "#foreach-condition"
1131 },
1132 {
1133 "include": "#csharp-code-block"
1134 },
1135 {
1136 "include": "#razor-codeblock-body"
1137 }
1138 ],
1139 "end": "(?<=})"
1140 },
1141 "foreach-condition": {
1142 "begin": "\\(",
1143 "beginCaptures": {
1144 "0": {
1145 "name": "punctuation.parenthesis.open.cs"
1146 }
1147 },
1148 "end": "\\)",
1149 "endCaptures": {
1150 "0": {
1151 "name": "punctuation.parenthesis.close.cs"
1152 }
1153 },
1154 "patterns": [
1155 {
1156 "match": "(?x)\n(?:\n (\\bvar\\b)|\n (?<type-name>\n (?:\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\n)\\s+\n(\\g<identifier>)\\s+\n\\b(in)\\b",
1157 "captures": {
1158 "1": {
1159 "name": "keyword.other.var.cs"
1160 },
1161 "2": {
1162 "patterns": [
1163 {
1164 "include": "source.cs#type"
1165 }
1166 ]
1167 },
1168 "7": {
1169 "name": "entity.name.variable.local.cs"
1170 },
1171 "8": {
1172 "name": "keyword.control.loop.in.cs"
1173 }
1174 }
1175 },
1176 {
1177 "match": "(?x) # match foreach (var (x, y) in ...)\n(?:\\b(var)\\b\\s*)?\n(?<tuple>\\((?:[^\\(\\)]|\\g<tuple>)+\\))\\s+\n\\b(in)\\b",
1178 "captures": {
1179 "1": {
1180 "name": "keyword.other.var.cs"
1181 },
1182 "2": {
1183 "patterns": [
1184 {
1185 "include": "source.cs#tuple-declaration-deconstruction-element-list"
1186 }
1187 ]
1188 },
1189 "3": {
1190 "name": "keyword.control.loop.in.cs"
1191 }
1192 }
1193 },
1194 {
1195 "include": "source.cs#expression"
1196 }
1197 ]
1198 },
1199 "do-statement": {
1200 "name": "meta.statement.do.razor",
1201 "begin": "(?:^\\s*|(@))(do)\\b\\s*",
1202 "beginCaptures": {
1203 "1": {
1204 "patterns": [
1205 {
1206 "include": "#transition"
1207 }
1208 ]
1209 },
1210 "2": {
1211 "name": "keyword.control.loop.do.cs"
1212 }
1213 },
1214 "patterns": [
1215 {
1216 "include": "#csharp-condition"
1217 },
1218 {
1219 "include": "#csharp-code-block"
1220 },
1221 {
1222 "include": "#razor-codeblock-body"
1223 }
1224 ],
1225 "end": "(?<=})"
1226 },
1227 "while-statement": {
1228 "name": "meta.statement.while.razor",
1229 "begin": "(?:(@)|^\\s*|(?<=})\\s*)(while)\\b\\s*(?=\\()",
1230 "beginCaptures": {
1231 "1": {
1232 "patterns": [
1233 {
1234 "include": "#transition"
1235 }
1236 ]
1237 },
1238 "2": {
1239 "name": "keyword.control.loop.while.cs"
1240 }
1241 },
1242 "patterns": [
1243 {
1244 "include": "#csharp-condition"
1245 },
1246 {
1247 "include": "#csharp-code-block"
1248 },
1249 {
1250 "include": "#razor-codeblock-body"
1251 }
1252 ],
1253 "end": "(?<=})|(;)",
1254 "endCaptures": {
1255 "1": {
1256 "name": "punctuation.terminator.statement.cs"
1257 }
1258 }
1259 },
1260 "switch-statement": {
1261 "name": "meta.statement.switch.razor",
1262 "begin": "(?:^\\s*|(@))(switch)\\b\\s*(?=\\()",
1263 "beginCaptures": {
1264 "1": {
1265 "patterns": [
1266 {
1267 "include": "#transition"
1268 }
1269 ]
1270 },
1271 "2": {
1272 "name": "keyword.control.switch.cs"
1273 }
1274 },
1275 "patterns": [
1276 {
1277 "include": "#csharp-condition"
1278 },
1279 {
1280 "include": "#switch-code-block"
1281 },
1282 {
1283 "include": "#razor-codeblock-body"
1284 }
1285 ],
1286 "end": "(?<=})"
1287 },
1288 "switch-code-block": {
1289 "name": "meta.structure.razor.csharp.codeblock.switch",
1290 "begin": "(\\{)",
1291 "beginCaptures": {
1292 "1": {
1293 "name": "punctuation.curlybrace.open.cs"
1294 }
1295 },
1296 "patterns": [
1297 {
1298 "include": "source.cs#switch-label"
1299 },
1300 {
1301 "include": "#razor-codeblock-body"
1302 }
1303 ],
1304 "end": "(\\})",
1305 "endCaptures": {
1306 "1": {
1307 "name": "punctuation.curlybrace.close.cs"
1308 }
1309 }
1310 },
1311 "lock-statement": {
1312 "name": "meta.statement.lock.razor",
1313 "begin": "(?:^\\s*|(@))(lock)\\b\\s*(?=\\()",
1314 "beginCaptures": {
1315 "1": {
1316 "patterns": [
1317 {
1318 "include": "#transition"
1319 }
1320 ]
1321 },
1322 "2": {
1323 "name": "keyword.other.lock.cs"
1324 }
1325 },
1326 "patterns": [
1327 {
1328 "include": "#csharp-condition"
1329 },
1330 {
1331 "include": "#csharp-code-block"
1332 },
1333 {
1334 "include": "#razor-codeblock-body"
1335 }
1336 ],
1337 "end": "(?<=})"
1338 },
1339 "try-statement": {
1340 "patterns": [
1341 {
1342 "include": "#try-block"
1343 },
1344 {
1345 "include": "#catch-clause"
1346 },
1347 {
1348 "include": "#finally-clause"
1349 }
1350 ]
1351 },
1352 "try-block": {
1353 "name": "meta.statement.try.razor",
1354 "begin": "(?:^\\s*|(@))(try)\\b\\s*",
1355 "beginCaptures": {
1356 "1": {
1357 "patterns": [
1358 {
1359 "include": "#transition"
1360 }
1361 ]
1362 },
1363 "2": {
1364 "name": "keyword.control.try.cs"
1365 }
1366 },
1367 "patterns": [
1368 {
1369 "include": "#csharp-condition"
1370 },
1371 {
1372 "include": "#csharp-code-block"
1373 },
1374 {
1375 "include": "#razor-codeblock-body"
1376 }
1377 ],
1378 "end": "(?<=})"
1379 },
1380 "catch-clause": {
1381 "name": "meta.statement.catch.razor",
1382 "begin": "(?:^|(?<=}))\\s*(catch)\\b\\s*?(?=[\\n\\(\\{])",
1383 "beginCaptures": {
1384 "1": {
1385 "name": "keyword.control.try.catch.cs"
1386 }
1387 },
1388 "patterns": [
1389 {
1390 "include": "#catch-condition"
1391 },
1392 {
1393 "include": "source.cs#when-clause"
1394 },
1395 {
1396 "include": "#csharp-code-block"
1397 },
1398 {
1399 "include": "#razor-codeblock-body"
1400 }
1401 ],
1402 "end": "(?<=})"
1403 },
1404 "catch-condition": {
1405 "begin": "\\(",
1406 "beginCaptures": {
1407 "0": {
1408 "name": "punctuation.parenthesis.open.cs"
1409 }
1410 },
1411 "end": "\\)",
1412 "endCaptures": {
1413 "0": {
1414 "name": "punctuation.parenthesis.close.cs"
1415 }
1416 },
1417 "patterns": [
1418 {
1419 "match": "(?x)\n(?<type-name>\n (?:\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s*\n(?:(\\g<identifier>)\\b)?",
1420 "captures": {
1421 "1": {
1422 "patterns": [
1423 {
1424 "include": "source.cs#type"
1425 }
1426 ]
1427 },
1428 "6": {
1429 "name": "entity.name.variable.local.cs"
1430 }
1431 }
1432 }
1433 ]
1434 },
1435 "finally-clause": {
1436 "name": "meta.statement.finally.razor",
1437 "begin": "(?:^|(?<=}))\\s*(finally)\\b\\s*?(?=[\\n\\{])",
1438 "beginCaptures": {
1439 "1": {
1440 "name": "keyword.control.try.finally.cs"
1441 }
1442 },
1443 "patterns": [
1444 {
1445 "include": "#csharp-code-block"
1446 },
1447 {
1448 "include": "#razor-codeblock-body"
1449 }
1450 ],
1451 "end": "(?<=})"
1452 },
1453 "await-prefix": {
1454 "name": "keyword.other.await.cs",
1455 "match": "(await)\\s+"
1456 },
1457 "csharp-code-block": {
1458 "name": "meta.structure.razor.csharp.codeblock",
1459 "begin": "(\\{)",
1460 "beginCaptures": {
1461 "1": {
1462 "name": "punctuation.curlybrace.open.cs"
1463 }
1464 },
1465 "patterns": [
1466 {
1467 "include": "#razor-codeblock-body"
1468 }
1469 ],
1470 "end": "(\\})",
1471 "endCaptures": {
1472 "1": {
1473 "name": "punctuation.curlybrace.close.cs"
1474 }
1475 }
1476 },
1477 "csharp-condition": {
1478 "begin": "(\\()",
1479 "beginCaptures": {
1480 "1": {
1481 "name": "punctuation.parenthesis.open.cs"
1482 }
1483 },
1484 "patterns": [
1485 {
1486 "include": "source.cs#local-variable-declaration"
1487 },
1488 {
1489 "include": "source.cs#expression"
1490 },
1491 {
1492 "include": "source.cs#punctuation-comma"
1493 },
1494 {
1495 "include": "source.cs#punctuation-semicolon"
1496 }
1497 ],
1498 "end": "(\\))",
1499 "endCaptures": {
1500 "1": {
1501 "name": "punctuation.parenthesis.close.cs"
1502 }
1503 }
1504 }
1505 }
1506 }
1507