Skip to content

Commit 3a84ff6

Browse files
authored
feat(vscode): support multiline attribute for <script> and <style> tag (#5830)
1 parent 8b9d74c commit 3a84ff6

File tree

1 file changed

+222
-22
lines changed

1 file changed

+222
-22
lines changed

extensions/vscode/syntaxes/vue.tmLanguage.json

Lines changed: 222 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -739,17 +739,7 @@
739739
},
740740
"patterns": [
741741
{
742-
"include": "#tag-stuff"
743-
},
744-
{
745-
"begin": "(?<=>)",
746-
"end": "(?=<\\/script[\\s>])",
747-
"name": "source.js",
748-
"patterns": [
749-
{
750-
"include": "source.js"
751-
}
752-
]
742+
"include": "#multi-line-script-tag-stuff"
753743
}
754744
]
755745
},
@@ -771,17 +761,7 @@
771761
},
772762
"patterns": [
773763
{
774-
"include": "#tag-stuff"
775-
},
776-
{
777-
"begin": "(?<=>)",
778-
"end": "(?=<\\/style[\\s>])",
779-
"name": "source.css",
780-
"patterns": [
781-
{
782-
"include": "source.css"
783-
}
784-
]
764+
"include": "#multi-line-style-tag-stuff"
785765
}
786766
]
787767
},
@@ -816,6 +796,226 @@
816796
}
817797
],
818798
"repository": {
799+
"multi-line-script-tag-stuff": {
800+
"begin": "\\G",
801+
"end": "(?=<\\/script[\\s>])",
802+
"patterns": [
803+
{
804+
"begin": "\\G(?!\\blang\\s*=\\s*(?:['\"]?)(?:ts|tsx|jsx|coffee)\\b)",
805+
"end": "(?=\\blang\\s*=\\s*(?:['\"]?)(?:ts|tsx|jsx|coffee)\\b)|(>)",
806+
"endCaptures": {
807+
"1": {
808+
"name": "punctuation.definition.tag.end.html.vue"
809+
}
810+
},
811+
"name": "meta.tag-stuff",
812+
"patterns": [
813+
{
814+
"include": "#vue-directives"
815+
},
816+
{
817+
"include": "text.html.basic#attribute"
818+
}
819+
]
820+
},
821+
{
822+
"begin": "(?=\\blang\\s*=\\s*(?:['\"]?)ts\\b)",
823+
"end": "(?=<\\/script[\\s>])",
824+
"patterns": [
825+
{
826+
"include": "#tag-stuff"
827+
},
828+
{
829+
"begin": "(?<=>)",
830+
"end": "(?=<\\/script[\\s>])",
831+
"name": "source.ts",
832+
"patterns": [
833+
{
834+
"include": "source.ts"
835+
}
836+
]
837+
}
838+
]
839+
},
840+
{
841+
"begin": "(?=\\blang\\s*=\\s*(?:['\"]?)tsx\\b)",
842+
"end": "(?=<\\/script[\\s>])",
843+
"patterns": [
844+
{
845+
"include": "#tag-stuff"
846+
},
847+
{
848+
"begin": "(?<=>)",
849+
"end": "(?=<\\/script[\\s>])",
850+
"name": "source.tsx",
851+
"patterns": [
852+
{
853+
"include": "source.tsx"
854+
}
855+
]
856+
}
857+
]
858+
},
859+
{
860+
"begin": "(?=\\blang\\s*=\\s*(?:['\"]?)jsx\\b)",
861+
"end": "(?=<\\/script[\\s>])",
862+
"patterns": [
863+
{
864+
"include": "#tag-stuff"
865+
},
866+
{
867+
"begin": "(?<=>)",
868+
"end": "(?=<\\/script[\\s>])",
869+
"name": "source.js.jsx",
870+
"patterns": [
871+
{
872+
"include": "source.js.jsx"
873+
}
874+
]
875+
}
876+
]
877+
},
878+
{
879+
"begin": "(?=\\blang\\s*=\\s*(?:['\"]?)coffee\\b)",
880+
"end": "(?=<\\/script[\\s>])",
881+
"patterns": [
882+
{
883+
"include": "#tag-stuff"
884+
},
885+
{
886+
"begin": "(?<=>)",
887+
"end": "(?=<\\/script[\\s>])",
888+
"name": "source.coffee",
889+
"patterns": [
890+
{
891+
"include": "source.coffee"
892+
}
893+
]
894+
}
895+
]
896+
},
897+
{
898+
"begin": "(?<=>)",
899+
"end": "(?=<\\/script[\\s>])",
900+
"name": "source.js",
901+
"patterns": [
902+
{
903+
"include": "source.js"
904+
}
905+
]
906+
}
907+
]
908+
},
909+
"multi-line-style-tag-stuff": {
910+
"begin": "\\G",
911+
"end": "(?=<\\/style[\\s>])",
912+
"patterns": [
913+
{
914+
"begin": "\\G(?!\\blang\\s*=\\s*(?:['\"]?)(?:scss|stylus|less|postcss)\\b)",
915+
"end": "(?=\\blang\\s*=\\s*(?:['\"]?)(?:scss|stylus|less|postcss)\\b)|(>)",
916+
"endCaptures": {
917+
"1": {
918+
"name": "punctuation.definition.tag.end.html.vue"
919+
}
920+
},
921+
"name": "meta.tag-stuff",
922+
"patterns": [
923+
{
924+
"include": "#vue-directives"
925+
},
926+
{
927+
"include": "text.html.basic#attribute"
928+
}
929+
]
930+
},
931+
{
932+
"begin": "(?=\\blang\\s*=\\s*(?:['\"]?)scss\\b)",
933+
"end": "(?=<\\/style[\\s>])",
934+
"patterns": [
935+
{
936+
"include": "#tag-stuff"
937+
},
938+
{
939+
"begin": "(?<=>)",
940+
"end": "(?=<\\/style[\\s>])",
941+
"name": "source.css.scss",
942+
"patterns": [
943+
{
944+
"include": "source.css.scss"
945+
}
946+
]
947+
}
948+
]
949+
},
950+
{
951+
"begin": "(?=\\blang\\s*=\\s*(?:['\"]?)stylus\\b)",
952+
"end": "(?=<\\/style[\\s>])",
953+
"patterns": [
954+
{
955+
"include": "#tag-stuff"
956+
},
957+
{
958+
"begin": "(?<=>)",
959+
"end": "(?=<\\/style[\\s>])",
960+
"name": "source.stylus",
961+
"patterns": [
962+
{
963+
"include": "source.stylus"
964+
}
965+
]
966+
}
967+
]
968+
},
969+
{
970+
"begin": "(?=\\blang\\s*=\\s*(?:['\"]?)less\\b)",
971+
"end": "(?=<\\/style[\\s>])",
972+
"patterns": [
973+
{
974+
"include": "#tag-stuff"
975+
},
976+
{
977+
"begin": "(?<=>)",
978+
"end": "(?=<\\/style[\\s>])",
979+
"name": "source.css.less",
980+
"patterns": [
981+
{
982+
"include": "source.css.less"
983+
}
984+
]
985+
}
986+
]
987+
},
988+
{
989+
"begin": "(?=\\blang\\s*=\\s*(?:['\"]?)postcss\\b)",
990+
"end": "(?=<\\/style[\\s>])",
991+
"patterns": [
992+
{
993+
"include": "#tag-stuff"
994+
},
995+
{
996+
"begin": "(?<=>)",
997+
"end": "(?=<\\/style[\\s>])",
998+
"name": "source.postcss",
999+
"patterns": [
1000+
{
1001+
"include": "source.postcss"
1002+
}
1003+
]
1004+
}
1005+
]
1006+
},
1007+
{
1008+
"begin": "(?<=>)",
1009+
"end": "(?=<\\/style[\\s>])",
1010+
"name": "source.css",
1011+
"patterns": [
1012+
{
1013+
"include": "source.css"
1014+
}
1015+
]
1016+
}
1017+
]
1018+
},
8191019
"self-closing-tag": {
8201020
"begin": "(<)([a-zA-Z0-9:-]+)(?=([^>]+/>))",
8211021
"beginCaptures": {

0 commit comments

Comments
 (0)