Improve `theme` helper detection
parent
64aa320d18
commit
15bc6dbc19
|
@ -179,7 +179,7 @@ export function getInvalidConfigPathDiagnostics(
|
||||||
ranges.forEach((range) => {
|
ranges.forEach((range) => {
|
||||||
let text = document.getText(range)
|
let text = document.getText(range)
|
||||||
let matches = findAll(
|
let matches = findAll(
|
||||||
/(?<prefix>\s|^)(?<helper>config|theme)\((?<quote>['"])(?<key>[^)]+)\k<quote>\)/g,
|
/(?<prefix>\s|^)(?<helper>config|theme)\((?<quote>['"])(?<key>[^)]+)\k<quote>[^)]*\)/g,
|
||||||
text
|
text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ function provideCssHelperHover(state: State, document: TextDocument, position: P
|
||||||
end: { line: position.line + 1, character: 0 },
|
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
|
if (match === null) return null
|
||||||
|
|
||||||
|
|
|
@ -341,7 +341,7 @@ export function findHelperFunctionsInRange(
|
||||||
): DocumentHelperFunction[] {
|
): DocumentHelperFunction[] {
|
||||||
const text = doc.getText(range)
|
const text = doc.getText(range)
|
||||||
const matches = findAll(
|
const matches = findAll(
|
||||||
/(?<before>^|\s)(?<helper>theme|config)\((?:(?<single>')([^']+)'|(?<double>")([^"]+)")\)/gm,
|
/(?<before>^|\s)(?<helper>theme|config)\((?:(?<single>')([^']+)'|(?<double>")([^"]+)")[^)]*\)/gm,
|
||||||
text
|
text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue