@@ -9,10 +9,7 @@ export interface LanguageBoundaries {
9
9
css : Range [ ]
10
10
}
11
11
12
- export function getLanguageBoundaries (
13
- state : State ,
14
- doc : TextDocument
15
- ) : LanguageBoundaries | null {
12
+ export function getLanguageBoundaries ( state : State , doc : TextDocument ) : LanguageBoundaries | null {
16
13
if ( isVueDoc ( doc ) ) {
17
14
let text = doc . getText ( )
18
15
let blocks = findAll (
@@ -23,10 +20,7 @@ export function getLanguageBoundaries(
23
20
let cssRanges : Range [ ] = [ ]
24
21
for ( let i = 0 ; i < blocks . length ; i ++ ) {
25
22
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 ) ,
30
24
end : indexToPosition (
31
25
text ,
32
26
blocks [ i ] . index + blocks [ i ] [ 0 ] . length - blocks [ i ] . groups . close . length
@@ -48,7 +42,7 @@ export function getLanguageBoundaries(
48
42
if ( isHtmlDoc ( state , doc ) || isJsDoc ( state , doc ) || isSvelteDoc ( doc ) ) {
49
43
let text = doc . getText ( )
50
44
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,
52
46
text
53
47
)
54
48
let htmlRanges : Range [ ] = [ ]
@@ -61,15 +55,10 @@ export function getLanguageBoundaries(
61
55
end : indexToPosition ( text , styleBlocks [ i ] . index ) ,
62
56
} )
63
57
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 ) ,
68
59
end : indexToPosition (
69
60
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
73
62
) ,
74
63
} )
75
64
currentIndex = styleBlocks [ i ] . index + styleBlocks [ i ] [ 0 ] . length
0 commit comments