File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
packages/tailwindcss-language-service/src Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -614,7 +614,7 @@ function provideCssHelperCompletions(
614614
615615 const match = text
616616 . substr ( 0 , text . length - 1 ) // don't include that extra character from earlier
617- . match ( / \b (?< helper > c o n f i g | t h e m e ) \( \s * [ ' " ] ? (?< path > [ ^ ) ' " ] * ) $ / )
617+ . match ( / [ \s : ; / * ( ) { } ] (?< helper > c o n f i g | t h e m e ) \( \s * [ ' " ] ? (?< path > [ ^ ) ' " ] * ) $ / )
618618
619619 if ( match === null ) {
620620 return null
Original file line number Diff line number Diff line change @@ -350,7 +350,10 @@ export function findHelperFunctionsInRange(
350350 range ?: Range
351351) : DocumentHelperFunction [ ] {
352352 const text = getTextWithoutComments ( doc , 'css' , range )
353- let matches = findAll ( / \b (?< helper > c o n f i g | t h e m e ) (?< innerPrefix > \( \s * ) (?< path > [ ^ ) ] * ?) \s * \) / g, text )
353+ let matches = findAll (
354+ / (?< prefix > [ \s : ; / * ( ) { } ] ) (?< helper > c o n f i g | t h e m e ) (?< innerPrefix > \( \s * ) (?< path > [ ^ ) ] * ?) \s * \) / g,
355+ text
356+ )
354357
355358 return matches . map ( ( match ) => {
356359 let quotesBefore = ''
@@ -364,7 +367,11 @@ export function findHelperFunctionsInRange(
364367 }
365368 path = path . replace ( / [ ' " ] * \s * $ / , '' )
366369
367- let startIndex = match . index + match . groups . helper . length + match . groups . innerPrefix . length
370+ let startIndex =
371+ match . index +
372+ match . groups . prefix . length +
373+ match . groups . helper . length +
374+ match . groups . innerPrefix . length
368375
369376 return {
370377 helper : match . groups . helper === 'theme' ? 'theme' : 'config' ,
You can’t perform that action at this time.
0 commit comments