Fix `classRegex` hovers in unknown contexts (#824)

master
Brad Cornes 2023-07-18 15:14:51 +01:00 committed by GitHub
parent a6c19d7cb4
commit 316357530f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -296,10 +296,10 @@ export async function findClassListsInRange(
mode?: 'html' | 'css' | 'jsx',
includeCustom: boolean = true
): Promise<DocumentClassList[]> {
let classLists: DocumentClassList[]
let classLists: DocumentClassList[] = []
if (mode === 'css') {
classLists = findClassListsInCssRange(state, doc, range)
} else {
} else if (mode === 'html' || mode === 'jsx') {
classLists = await findClassListsInHtmlRange(state, doc, mode, range)
}
return dedupeByRange([
@ -449,6 +449,8 @@ export async function findClassNameAtPosition(
classNames = await findClassNamesInRange(state, doc, searchRange, 'html')
} else if (isJsxContext(state, doc, position)) {
classNames = await findClassNamesInRange(state, doc, searchRange, 'jsx')
} else {
classNames = await findClassNamesInRange(state, doc, searchRange)
}
if (classNames.length === 0) {