Skip to content

Commit 3163575

Browse files
authored
Fix classRegex hovers in unknown contexts (#824)
1 parent a6c19d7 commit 3163575

File tree

1 file changed

+4
-2
lines changed
  • packages/tailwindcss-language-service/src/util

1 file changed

+4
-2
lines changed

packages/tailwindcss-language-service/src/util/find.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,10 @@ export async function findClassListsInRange(
296296
mode?: 'html' | 'css' | 'jsx',
297297
includeCustom: boolean = true
298298
): Promise<DocumentClassList[]> {
299-
let classLists: DocumentClassList[]
299+
let classLists: DocumentClassList[] = []
300300
if (mode === 'css') {
301301
classLists = findClassListsInCssRange(state, doc, range)
302-
} else {
302+
} else if (mode === 'html' || mode === 'jsx') {
303303
classLists = await findClassListsInHtmlRange(state, doc, mode, range)
304304
}
305305
return dedupeByRange([
@@ -449,6 +449,8 @@ export async function findClassNameAtPosition(
449449
classNames = await findClassNamesInRange(state, doc, searchRange, 'html')
450450
} else if (isJsxContext(state, doc, position)) {
451451
classNames = await findClassNamesInRange(state, doc, searchRange, 'jsx')
452+
} else {
453+
classNames = await findClassNamesInRange(state, doc, searchRange)
452454
}
453455

454456
if (classNames.length === 0) {

0 commit comments

Comments
 (0)