tweak style block regexes
parent
62ddc243d3
commit
a4f5a5f287
|
@ -42,7 +42,7 @@ export function getLanguageBoundaries(state: State, doc: TextDocument): Language
|
|||
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[^>]*[^\/]>|\s*>)).*?(?<close><\/style>|$)/gis,
|
||||
text
|
||||
)
|
||||
let htmlRanges: Range[] = []
|
||||
|
|
|
@ -44,7 +44,7 @@ export function isInsideTag(str: string, tag: string | string[]): boolean {
|
|||
let close = 0
|
||||
let match: RegExpExecArray
|
||||
let tags = Array.isArray(tag) ? tag : [tag]
|
||||
let regex = new RegExp(`<(?<slash>/?)(?:${tags.join('|')})(?:\\s[^>]*[^\/]>|>|[^\/]>)`, 'ig')
|
||||
let regex = new RegExp(`<(?<slash>/?)(?:${tags.join('|')})(?:\\s[^>]*[^\/]>|\\s*>)`, 'ig')
|
||||
while ((match = regex.exec(str)) !== null) {
|
||||
if (match.groups.slash) {
|
||||
close += 1
|
||||
|
|
Loading…
Reference in New Issue