@@ -9,10 +9,7 @@ export interface LanguageBoundaries {
99 css : Range [ ]
1010}
1111
12- export function getLanguageBoundaries (
13- state : State ,
14- doc : TextDocument
15- ) : LanguageBoundaries | null {
12+ export function getLanguageBoundaries ( state : State , doc : TextDocument ) : LanguageBoundaries | null {
1613 if ( isVueDoc ( doc ) ) {
1714 let text = doc . getText ( )
1815 let blocks = findAll (
@@ -23,10 +20,7 @@ export function getLanguageBoundaries(
2320 let cssRanges : Range [ ] = [ ]
2421 for ( let i = 0 ; i < blocks . length ; i ++ ) {
2522 let range = {
26- start : indexToPosition (
27- text ,
28- blocks [ i ] . index + blocks [ i ] . groups . open . length
29- ) ,
23+ start : indexToPosition ( text , blocks [ i ] . index + blocks [ i ] . groups . open . length ) ,
3024 end : indexToPosition (
3125 text ,
3226 blocks [ i ] . index + blocks [ i ] [ 0 ] . length - blocks [ i ] . groups . close . length
@@ -48,7 +42,7 @@ export function getLanguageBoundaries(
4842 if ( isHtmlDoc ( state , doc ) || isJsDoc ( state , doc ) || isSvelteDoc ( doc ) ) {
4943 let text = doc . getText ( )
5044 let styleBlocks = findAll (
51- / (?< open > < s t y l e (?: \s [ ^ > ] * > | > ) ) .* ?(?< close > < \/ s t y l e > | $ ) / gis,
45+ / (?< open > < s t y l e (?: \s [ ^ > ] * [ ^ \/ ] > | > | [ ^ \/ ] > ) ) .* ?(?< close > < \/ s t y l e > | $ ) / gis,
5246 text
5347 )
5448 let htmlRanges : Range [ ] = [ ]
@@ -61,15 +55,10 @@ export function getLanguageBoundaries(
6155 end : indexToPosition ( text , styleBlocks [ i ] . index ) ,
6256 } )
6357 cssRanges . push ( {
64- start : indexToPosition (
65- text ,
66- styleBlocks [ i ] . index + styleBlocks [ i ] . groups . open . length
67- ) ,
58+ start : indexToPosition ( text , styleBlocks [ i ] . index + styleBlocks [ i ] . groups . open . length ) ,
6859 end : indexToPosition (
6960 text ,
70- styleBlocks [ i ] . index +
71- styleBlocks [ i ] [ 0 ] . length -
72- styleBlocks [ i ] . groups . close . length
61+ styleBlocks [ i ] . index + styleBlocks [ i ] [ 0 ] . length - styleBlocks [ i ] . groups . close . length
7362 ) ,
7463 } )
7564 currentIndex = styleBlocks [ i ] . index + styleBlocks [ i ] [ 0 ] . length
0 commit comments