Fix `classRegex` hovers in unknown contexts (#824)
parent
a6c19d7cb4
commit
316357530f
|
@ -296,10 +296,10 @@ export async function findClassListsInRange(
|
||||||
mode?: 'html' | 'css' | 'jsx',
|
mode?: 'html' | 'css' | 'jsx',
|
||||||
includeCustom: boolean = true
|
includeCustom: boolean = true
|
||||||
): Promise<DocumentClassList[]> {
|
): Promise<DocumentClassList[]> {
|
||||||
let classLists: DocumentClassList[]
|
let classLists: DocumentClassList[] = []
|
||||||
if (mode === 'css') {
|
if (mode === 'css') {
|
||||||
classLists = findClassListsInCssRange(state, doc, range)
|
classLists = findClassListsInCssRange(state, doc, range)
|
||||||
} else {
|
} else if (mode === 'html' || mode === 'jsx') {
|
||||||
classLists = await findClassListsInHtmlRange(state, doc, mode, range)
|
classLists = await findClassListsInHtmlRange(state, doc, mode, range)
|
||||||
}
|
}
|
||||||
return dedupeByRange([
|
return dedupeByRange([
|
||||||
|
@ -449,6 +449,8 @@ export async function findClassNameAtPosition(
|
||||||
classNames = await findClassNamesInRange(state, doc, searchRange, 'html')
|
classNames = await findClassNamesInRange(state, doc, searchRange, 'html')
|
||||||
} else if (isJsxContext(state, doc, position)) {
|
} else if (isJsxContext(state, doc, position)) {
|
||||||
classNames = await findClassNamesInRange(state, doc, searchRange, 'jsx')
|
classNames = await findClassNamesInRange(state, doc, searchRange, 'jsx')
|
||||||
|
} else {
|
||||||
|
classNames = await findClassNamesInRange(state, doc, searchRange)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (classNames.length === 0) {
|
if (classNames.length === 0) {
|
||||||
|
|
Loading…
Reference in New Issue