@@ -505,6 +505,8 @@ export class TW {
505
505
}
506
506
}
507
507
508
+ console . log ( `[Global] Preparing projects...` )
509
+
508
510
await Promise . all (
509
511
workspaceFolders . map ( ( projectConfig ) =>
510
512
this . addProject (
@@ -517,18 +519,24 @@ export class TW {
517
519
) ,
518
520
)
519
521
522
+ console . log ( `[Global] Initializing projects...` )
523
+
520
524
// init projects for documents that are _already_ open
521
525
let readyDocuments : string [ ] = [ ]
526
+ let enabledProjectCount = 0
522
527
for ( let document of this . documentService . getAllDocuments ( ) ) {
523
528
let project = this . getProject ( document )
524
529
if ( project && ! project . enabled ( ) ) {
525
530
project . enable ( )
526
531
await project . tryInit ( )
532
+ enabledProjectCount ++
527
533
}
528
534
529
535
readyDocuments . push ( document . uri )
530
536
}
531
537
538
+ console . log ( `[Global] Initialized ${ enabledProjectCount } projects` )
539
+
532
540
this . setupLSPHandlers ( )
533
541
534
542
this . disposables . push (
@@ -554,6 +562,8 @@ export class TW {
554
562
555
563
if ( ! isTestMode ) return
556
564
565
+ console . log ( `[Global][Test] Sending document notifications...` )
566
+
557
567
await Promise . all (
558
568
readyDocuments . map ( ( uri ) =>
559
569
this . connection . sendNotification ( '@/tailwindCSS/documentReady' , {
@@ -783,20 +793,55 @@ export class TW {
783
793
return 0
784
794
} )
785
795
for ( let selector of documentSelector ) {
786
- let fsPath = URI . parse ( document . uri ) . fsPath
796
+ let uri = URI . parse ( document . uri )
787
797
let pattern = selector . pattern . replace ( / [ \[ \] { } ] / g, ( m ) => `\\${ m } ` )
788
798
799
+ let fsPath = uri . fsPath
800
+ let normalPath = uri . path
801
+
789
802
// This filename comes from VSCode rather than from the filesystem
790
803
// which means the drive letter *might* be lowercased and we need
791
804
// to normalize it so that we can compare it properly.
792
805
fsPath = normalizeDriveLetter ( fsPath )
793
806
794
- if ( pattern . startsWith ( '!' ) && picomatch ( pattern . slice ( 1 ) , { dot : true } ) ( fsPath ) ) {
795
- break
807
+ console . log ( '[GLOBAL] Checking document' , {
808
+ fsPath,
809
+ normalPath,
810
+ } )
811
+
812
+ if ( pattern . startsWith ( '!' ) ) {
813
+ if ( picomatch ( pattern . slice ( 1 ) , { dot : true } ) ( fsPath ) ) {
814
+ break
815
+ }
816
+
817
+ if ( picomatch ( pattern . slice ( 1 ) , { dot : true } ) ( normalPath ) ) {
818
+ console . log ( '[GLOBAL] Matched ignored non-FS path' , {
819
+ pattern,
820
+ } )
821
+
822
+ break
823
+ }
796
824
}
825
+
797
826
if ( picomatch ( pattern , { dot : true } ) ( fsPath ) && selector . priority < matchedPriority ) {
798
827
matchedProject = project
799
828
matchedPriority = selector . priority
829
+
830
+ continue
831
+ }
832
+
833
+ if (
834
+ picomatch ( pattern , { dot : true } ) ( normalPath ) &&
835
+ selector . priority < matchedPriority
836
+ ) {
837
+ console . log ( '[GLOBAL] Matched non-FS path' , {
838
+ pattern,
839
+ } )
840
+
841
+ matchedProject = project
842
+ matchedPriority = selector . priority
843
+
844
+ continue
800
845
}
801
846
}
802
847
} else {
0 commit comments