Skip to content

Commit 9ee8b19

Browse files
committed
wip
1 parent 43fab13 commit 9ee8b19

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -222,27 +222,6 @@ test('test nested classFunctions', async ({ expect }) => {
222222
end: { line: 19, character: 26 },
223223
},
224224
},
225-
{
226-
classList: 'fixed flex',
227-
range: {
228-
start: { line: 3, character: 9 },
229-
end: { line: 3, character: 19 },
230-
},
231-
},
232-
{
233-
classList: 'md:h-[calc(100%-2rem)]',
234-
range: {
235-
start: { line: 4, character: 9 },
236-
end: { line: 4, character: 31 },
237-
},
238-
},
239-
{
240-
classList: 'bg-red-700',
241-
range: {
242-
start: { line: 5, character: 9 },
243-
end: { line: 5, character: 19 },
244-
},
245-
},
246225
]
247226

248227
const content = `

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,16 @@ export function matchClassFunctions(text: string, fnNames: string[]): RegExpMatc
179179
// - It needs to be in an expression position — so it must be preceded by
180180
// whitespace, parens, curlies, commas, whitespace, etc…
181181
// - It must look like a fn call or a tagged template literal
182-
let FN_NAMES = /(?<=^|[:=,;\s{()])([\p{ID_Start}$_][\p{ID_Continue}$_.]*)[(`]/dgu
182+
let FN_NAMES = /(?<=^|[:=,;\s{()])([\p{ID_Start}$_][\p{ID_Continue}$_.]*)[(`]/dgiu
183183
let foundFns = findAll(FN_NAMES, text)
184184

185185
// 3. Match against the function names in the document
186186
let re = /^(NAMES)$/
187187
let isClassFn = new RegExp(re.source.replace('NAMES', names.join('|')), 'dgi')
188-
return foundFns.filter((fn) => isClassFn.test(fn[1]))
188+
189+
let matches = foundFns.filter((fn) => isClassFn.test(fn[1]))
190+
191+
return matches
189192
}
190193

191194
export async function findClassListsInHtmlRange(

0 commit comments

Comments
 (0)