Improve `theme` helper detection (#655)
parent
0625c6de35
commit
9bff008eae
|
@ -350,10 +350,7 @@ export function findHelperFunctionsInRange(
|
||||||
range?: Range
|
range?: Range
|
||||||
): DocumentHelperFunction[] {
|
): DocumentHelperFunction[] {
|
||||||
const text = getTextWithoutComments(doc, 'css', range)
|
const text = getTextWithoutComments(doc, 'css', range)
|
||||||
let matches = findAll(
|
let matches = findAll(/\b(?<helper>config|theme)(?<innerPrefix>\(\s*)(?<path>[^)]*?)\s*\)/g, text)
|
||||||
/(?<prefix>\s|^)(?<helper>config|theme)(?<innerPrefix>\(\s*)(?<path>[^)]*?)\s*\)/g,
|
|
||||||
text
|
|
||||||
)
|
|
||||||
|
|
||||||
return matches.map((match) => {
|
return matches.map((match) => {
|
||||||
let quotesBefore = ''
|
let quotesBefore = ''
|
||||||
|
@ -367,11 +364,7 @@ export function findHelperFunctionsInRange(
|
||||||
}
|
}
|
||||||
path = path.replace(/['"]*\s*$/, '')
|
path = path.replace(/['"]*\s*$/, '')
|
||||||
|
|
||||||
let startIndex =
|
let startIndex = match.index + match.groups.helper.length + match.groups.innerPrefix.length
|
||||||
match.index +
|
|
||||||
match.groups.prefix.length +
|
|
||||||
match.groups.helper.length +
|
|
||||||
match.groups.innerPrefix.length
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
helper: match.groups.helper === 'theme' ? 'theme' : 'config',
|
helper: match.groups.helper === 'theme' ? 'theme' : 'config',
|
||||||
|
|
Loading…
Reference in New Issue