File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
packages/tailwindcss-language-server/src Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -427,11 +427,18 @@ export class ProjectLocator {
427
427
if ( indexPath && themePath ) graph . connect ( indexPath , themePath )
428
428
if ( indexPath && utilitiesPath ) graph . connect ( indexPath , utilitiesPath )
429
429
430
- for ( let root of graph . roots ( ) ) {
431
- if ( ! root . meta ) continue
430
+ // Sort the graph so potential "roots" appear first
431
+ // The entire concept of roots needs to be rethought because it's not always
432
+ // clear what the root of a project is. Even when imports are present a file
433
+ // may import a file that is the actual "root" of the project.
434
+ let roots = Array . from ( graph . roots ( ) )
435
+
436
+ roots . sort ( ( a , b ) => {
437
+ return a . meta . root === b . meta . root ? 0 : a . meta . root ? - 1 : 1
438
+ } )
432
439
433
- // This file is not eligible to act as a root of the CSS graph
434
- if ( root . meta . root === false ) continue
440
+ for ( let root of roots ) {
441
+ if ( ! root . meta ) continue
435
442
436
443
let config : ConfigEntry = configs . remember ( root . path , ( ) => ( {
437
444
source : 'css' ,
You can’t perform that action at this time.
0 commit comments