1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
diff --git a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
index c60c43c93f7cf6b3974decfeb5565f9ec3d2efce..89773118f52d5cd5c0358158b84e58d4f487f290 100644
--- a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
+++ b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
@@ -9,10 +9,7 @@ html: Range[]
css: Range[]
}
-export function getLanguageBoundaries(
- state: State,
- doc: TextDocument
-): LanguageBoundaries | null {
+export function getLanguageBoundaries(state: State, doc: TextDocument): LanguageBoundaries | null {
if (isVueDoc(doc)) {
let text = doc.getText()
let blocks = findAll(
@@ -23,10 +20,7 @@ let htmlRanges: Range[] = []
let cssRanges: Range[] = []
for (let i = 0; i < blocks.length; i++) {
let range = {
- start: indexToPosition(
- text,
- blocks[i].index + blocks[i].groups.open.length
- ),
+ start: indexToPosition(text, blocks[i].index + blocks[i].groups.open.length),
end: indexToPosition(
text,
blocks[i].index + blocks[i][0].length - blocks[i].groups.close.length
@@ -48,7 +42,7 @@
if (isHtmlDoc(state, doc) || isJsDoc(state, doc) || isSvelteDoc(doc)) {
let text = doc.getText()
let styleBlocks = findAll(
- /(?<open><style(?:\s[^>]*>|>)).*?(?<close><\/style>|$)/gis,
+ /(?<open><style(?:\s[^>]*[^\/]>|>|[^\/]>)).*?(?<close><\/style>|$)/gis,
text
)
let htmlRanges: Range[] = []
@@ -61,15 +55,10 @@ start: indexToPosition(text, currentIndex),
end: indexToPosition(text, styleBlocks[i].index),
})
cssRanges.push({
- start: indexToPosition(
- text,
- styleBlocks[i].index + styleBlocks[i].groups.open.length
- ),
+ start: indexToPosition(text, styleBlocks[i].index + styleBlocks[i].groups.open.length),
end: indexToPosition(
text,
- styleBlocks[i].index +
- styleBlocks[i][0].length -
- styleBlocks[i].groups.close.length
+ styleBlocks[i].index + styleBlocks[i][0].length - styleBlocks[i].groups.close.length
),
})
currentIndex = styleBlocks[i].index + styleBlocks[i][0].length
|