Skip to content

Commit 47d512e

Browse files
authored
Expand classRegex search range (#840)
1 parent 5c59d6f commit 47d512e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/tailwindcss-language-service/src/completionProvider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ async function provideCustomClassNameCompletions(
499499
const positionOffset = document.offsetAt(position)
500500

501501
const searchRange: Range = {
502-
start: document.positionAt(Math.max(0, positionOffset - 1000)),
503-
end: document.positionAt(positionOffset + 1000),
502+
start: document.positionAt(0),
503+
end: document.positionAt(positionOffset + 2000),
504504
}
505505

506506
let str = document.getText(searchRange)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ async function findCustomClassLists(
135135

136136
if (!Array.isArray(regexes) || regexes.length === 0) return []
137137

138-
const text = doc.getText(range)
138+
const text = doc.getText(range ? { ...range, start: doc.positionAt(0) } : undefined)
139139
const result: DocumentClassList[] = []
140140

141141
for (let i = 0; i < regexes.length; i++) {

0 commit comments

Comments
 (0)