Skip to content

Commit 23dc770

Browse files
committed
Refactor
1 parent 5dc6bd2 commit 23dc770

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/tailwindcss-language-server/src/project-locator.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,18 @@ export class ProjectLocator {
382382
if (indexPath && themePath) graph.connect(indexPath, themePath)
383383
if (indexPath && utilitiesPath) graph.connect(indexPath, utilitiesPath)
384384

385-
// Sort the graph so potential "roots" appear first
386-
// The entire concept of roots needs to be rethought because it's not always
387-
// clear what the root of a project is. Even when imports are present a file
388-
// may import a file that is the actual "root" of the project.
389385
let roots = Array.from(graph.roots())
390386

391387
roots.sort((a, b) => {
392-
return a.meta.root === b.meta.root ? 0 : a.meta.root ? -1 : 1
388+
return (
389+
// Sort the graph so potential "roots" appear first
390+
// The entire concept of roots needs to be rethought because it's not always
391+
// clear what the root of a project is. Even when imports are present a file
392+
// may import a file that is the actual "root" of the project.
393+
Number(b.meta.root) - Number(a.meta.root) ||
394+
// Otherwise stylesheets are kept in discovery order
395+
0
396+
)
393397
})
394398

395399
for (let root of roots) {

0 commit comments

Comments
 (0)