@@ -44,7 +44,6 @@ export function completionsFromClassList(
44
44
classList : string ,
45
45
classListRange : Range ,
46
46
filter ?: ( item : CompletionItem ) => boolean ,
47
- document ?: TextDocument ,
48
47
context ?: CompletionContext
49
48
) : CompletionList {
50
49
let classNames = classList . split ( / [ \s + ] / )
@@ -464,7 +463,6 @@ async function provideClassAttributeCompletions(
464
463
end : position ,
465
464
} ,
466
465
undefined ,
467
- document ,
468
466
context
469
467
)
470
468
}
@@ -476,7 +474,8 @@ async function provideClassAttributeCompletions(
476
474
async function provideCustomClassNameCompletions (
477
475
state : State ,
478
476
document : TextDocument ,
479
- position : Position
477
+ position : Position ,
478
+ context ?: CompletionContext
480
479
) : Promise < CompletionList > {
481
480
const settings = await state . editor . getConfiguration ( document . uri )
482
481
const regexes = settings . tailwindCSS . experimental . classRegex
@@ -527,13 +526,19 @@ async function provideCustomClassNameCompletions(
527
526
classList = containerMatch [ 1 ] . substr ( 0 , cursor - matchStart )
528
527
}
529
528
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 ,
534
538
} ,
535
- end : position ,
536
- } )
539
+ undefined ,
540
+ context
541
+ )
537
542
}
538
543
}
539
544
} catch ( _ ) { }
@@ -545,7 +550,8 @@ async function provideCustomClassNameCompletions(
545
550
function provideAtApplyCompletions (
546
551
state : State ,
547
552
document : TextDocument ,
548
- position : Position
553
+ position : Position ,
554
+ context ?: CompletionContext
549
555
) : CompletionList {
550
556
let str = document . getText ( {
551
557
start : { line : Math . max ( position . line - 30 , 0 ) , character : 0 } ,
@@ -580,7 +586,8 @@ function provideAtApplyCompletions(
580
586
let className = item . data ?. className ?? item . label
581
587
let validated = validateApply ( state , [ ...variants , className ] )
582
588
return validated !== null && validated . isApplyable === true
583
- }
589
+ } ,
590
+ context
584
591
)
585
592
}
586
593
@@ -596,7 +603,7 @@ async function provideClassNameCompletions(
596
603
context ?: CompletionContext
597
604
) : Promise < CompletionList > {
598
605
if ( isCssContext ( state , document , position ) ) {
599
- return provideAtApplyCompletions ( state , document , position )
606
+ return provideAtApplyCompletions ( state , document , position , context )
600
607
}
601
608
602
609
if ( isHtmlContext ( state , document , position ) || isJsxContext ( state , document , position ) ) {
@@ -1329,7 +1336,7 @@ export async function doComplete(
1329
1336
provideTailwindDirectiveCompletions ( state , document , position ) ||
1330
1337
provideLayerDirectiveCompletions ( state , document , position ) ||
1331
1338
( await provideConfigDirectiveCompletions ( state , document , position ) ) ||
1332
- ( await provideCustomClassNameCompletions ( state , document , position ) )
1339
+ ( await provideCustomClassNameCompletions ( state , document , position , context ) )
1333
1340
1334
1341
if ( result ) return result
1335
1342
0 commit comments