PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.27.4
Code Block Pro – Beautiful Syntax Highlighting v1.27.4
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.27.4, at build/shiki/languages/razor.tmLanguage.json

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