Skip to content

Commit a4f5a5f

Browse files
committed
tweak style block regexes
1 parent 62ddc24 commit a4f5a5f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function getLanguageBoundaries(state: State, doc: TextDocument): Language
4242
if (isHtmlDoc(state, doc) || isJsDoc(state, doc) || isSvelteDoc(doc)) {
4343
let text = doc.getText()
4444
let styleBlocks = findAll(
45-
/(?<open><style(?:\s[^>]*[^\/]>|>|[^\/]>)).*?(?<close><\/style>|$)/gis,
45+
/(?<open><style(?:\s[^>]*[^\/]>|\s*>)).*?(?<close><\/style>|$)/gis,
4646
text
4747
)
4848
let htmlRanges: Range[] = []

packages/tailwindcss-language-service/src/util/html.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function isInsideTag(str: string, tag: string | string[]): boolean {
4444
let close = 0
4545
let match: RegExpExecArray
4646
let tags = Array.isArray(tag) ? tag : [tag]
47-
let regex = new RegExp(`<(?<slash>/?)(?:${tags.join('|')})(?:\\s[^>]*[^\/]>|>|[^\/]>)`, 'ig')
47+
let regex = new RegExp(`<(?<slash>/?)(?:${tags.join('|')})(?:\\s[^>]*[^\/]>|\\s*>)`, 'ig')
4848
while ((match = regex.exec(str)) !== null) {
4949
if (match.groups.slash) {
5050
close += 1

0 commit comments

Comments
 (0)