@@ -44,7 +44,6 @@ export function completionsFromClassList(
4444 classList : string ,
4545 classListRange : Range ,
4646 filter ?: ( item : CompletionItem ) => boolean ,
47- document ?: TextDocument ,
4847 context ?: CompletionContext
4948) : CompletionList {
5049 let classNames = classList . split ( / [ \s + ] / )
@@ -464,7 +463,6 @@ async function provideClassAttributeCompletions(
464463 end : position ,
465464 } ,
466465 undefined ,
467- document ,
468466 context
469467 )
470468 }
@@ -476,7 +474,8 @@ async function provideClassAttributeCompletions(
476474async function provideCustomClassNameCompletions (
477475 state : State ,
478476 document : TextDocument ,
479- position : Position
477+ position : Position ,
478+ context ?: CompletionContext
480479) : Promise < CompletionList > {
481480 const settings = await state . editor . getConfiguration ( document . uri )
482481 const regexes = settings . tailwindCSS . experimental . classRegex
@@ -527,13 +526,19 @@ async function provideCustomClassNameCompletions(
527526 classList = containerMatch [ 1 ] . substr ( 0 , cursor - matchStart )
528527 }
529528
530- return completionsFromClassList ( state , classList , {
531- start : {
532- line : position . line ,
533- character : position . character - classList . length ,
529+ return completionsFromClassList (
530+ state ,
531+ classList ,
532+ {
533+ start : {
534+ line : position . line ,
535+ character : position . character - classList . length ,
536+ } ,
537+ end : position ,
534538 } ,
535- end : position ,
536- } )
539+ undefined ,
540+ context
541+ )
537542 }
538543 }
539544 } catch ( _ ) { }
@@ -545,7 +550,8 @@ async function provideCustomClassNameCompletions(
545550function provideAtApplyCompletions (
546551 state : State ,
547552 document : TextDocument ,
548- position : Position
553+ position : Position ,
554+ context ?: CompletionContext
549555) : CompletionList {
550556 let str = document . getText ( {
551557 start : { line : Math . max ( position . line - 30 , 0 ) , character : 0 } ,
@@ -580,7 +586,8 @@ function provideAtApplyCompletions(
580586 let className = item . data ?. className ?? item . label
581587 let validated = validateApply ( state , [ ...variants , className ] )
582588 return validated !== null && validated . isApplyable === true
583- }
589+ } ,
590+ context
584591 )
585592}
586593
@@ -596,7 +603,7 @@ async function provideClassNameCompletions(
596603 context ?: CompletionContext
597604) : Promise < CompletionList > {
598605 if ( isCssContext ( state , document , position ) ) {
599- return provideAtApplyCompletions ( state , document , position )
606+ return provideAtApplyCompletions ( state , document , position , context )
600607 }
601608
602609 if ( isHtmlContext ( state , document , position ) || isJsxContext ( state , document , position ) ) {
@@ -1329,7 +1336,7 @@ export async function doComplete(
13291336 provideTailwindDirectiveCompletions ( state , document , position ) ||
13301337 provideLayerDirectiveCompletions ( state , document , position ) ||
13311338 ( await provideConfigDirectiveCompletions ( state , document , position ) ) ||
1332- ( await provideCustomClassNameCompletions ( state , document , position ) )
1339+ ( await provideCustomClassNameCompletions ( state , document , position , context ) )
13331340
13341341 if ( result ) return result
13351342
0 commit comments