Improve `theme` helper detection

master
Brad Cornes 2022-06-02 14:40:37 +01:00
parent 64aa320d18
commit 15bc6dbc19
3 changed files with 3 additions and 3 deletions

View File

@ -179,7 +179,7 @@ export function getInvalidConfigPathDiagnostics(
ranges.forEach((range) => {
let text = document.getText(range)
let matches = findAll(
/(?<prefix>\s|^)(?<helper>config|theme)\((?<quote>['"])(?<key>[^)]+)\k<quote>\)/g,
/(?<prefix>\s|^)(?<helper>config|theme)\((?<quote>['"])(?<key>[^)]+)\k<quote>[^)]*\)/g,
text
)

View File

@ -28,7 +28,7 @@ function provideCssHelperHover(state: State, document: TextDocument, position: P
end: { line: position.line + 1, character: 0 },
})
const match = line.match(/(?<helper>theme|config)\((?<quote>['"])(?<key>[^)]+)\k<quote>\)/)
const match = line.match(/(?<helper>theme|config)\((?<quote>['"])(?<key>[^)]+)\k<quote>[^)]*\)/)
if (match === null) return null

View File

@ -341,7 +341,7 @@ export function findHelperFunctionsInRange(
): DocumentHelperFunction[] {
const text = doc.getText(range)
const matches = findAll(
/(?<before>^|\s)(?<helper>theme|config)\((?:(?<single>')([^']+)'|(?<double>")([^"]+)")\)/gm,
/(?<before>^|\s)(?<helper>theme|config)\((?:(?<single>')([^']+)'|(?<double>")([^"]+)")[^)]*\)/gm,
text
)