File tree 3 files changed +51
-3
lines changed
tailwindcss-language-server/src
3 files changed +51
-3
lines changed Original file line number Diff line number Diff line change @@ -462,6 +462,43 @@ testLocator({
462
462
] ,
463
463
} )
464
464
465
+ testLocator ( {
466
+ name : 'File exclusions starting with `/` do not cause traversal to loop forever' ,
467
+ fs : {
468
+ 'index.css' : css `
469
+ @import 'tailwindcss';
470
+ ` ,
471
+ 'vendor/a.css' : css `
472
+ @import 'tailwindcss';
473
+ ` ,
474
+ 'vendor/nested/b.css' : css `
475
+ @import 'tailwindcss';
476
+ ` ,
477
+ 'src/vendor/c.css' : css `
478
+ @import 'tailwindcss';
479
+ ` ,
480
+ } ,
481
+ settings : {
482
+ tailwindCSS : {
483
+ files : {
484
+ exclude : [ '/vendor' ] ,
485
+ } ,
486
+ } as Settings [ 'tailwindCSS' ] ,
487
+ } ,
488
+ expected : [
489
+ {
490
+ version : '4.1.1 (bundled)' ,
491
+ config : '/index.css' ,
492
+ content : [ ] ,
493
+ } ,
494
+ {
495
+ version : '4.1.1 (bundled)' ,
496
+ config : '/src/vendor/c.css' ,
497
+ content : [ ] ,
498
+ } ,
499
+ ] ,
500
+ } )
501
+
465
502
// ---
466
503
467
504
function testLocator ( {
@@ -502,7 +539,7 @@ function testLocator({
502
539
} )
503
540
}
504
541
505
- async function prepare ( { root } : TestUtils ) {
542
+ async function prepare ( { root } : TestUtils < any > ) {
506
543
let defaultSettings = {
507
544
tailwindCSS : {
508
545
files : {
Original file line number Diff line number Diff line change @@ -274,11 +274,22 @@ export class ProjectLocator {
274
274
}
275
275
276
276
private async findConfigs ( ) : Promise < ConfigEntry [ ] > {
277
+ let ignore = this . settings . tailwindCSS . files . exclude
278
+
279
+ // NOTE: This is a temporary workaround for a bug in the `fdir` package used
280
+ // by `tinyglobby`. It infinite loops when the ignore pattern starts with
281
+ // a `/`. This should be removed once the bug is fixed.
282
+ ignore = ignore . map ( ( pattern ) => {
283
+ if ( ! pattern . startsWith ( '/' ) ) return pattern
284
+
285
+ return pattern . slice ( 1 )
286
+ } )
287
+
277
288
// Look for config files and CSS files
278
289
let files = await glob ( {
279
290
patterns : [ `**/${ CONFIG_GLOB } ` , `**/${ CSS_GLOB } ` ] ,
280
291
cwd : this . base ,
281
- ignore : this . settings . tailwindCSS . files . exclude ,
292
+ ignore,
282
293
onlyFiles : true ,
283
294
absolute : true ,
284
295
followSymbolicLinks : true ,
Original file line number Diff line number Diff line change 2
2
3
3
## Prerelease
4
4
5
- - Nothing yet!
5
+ - Prevent infinite loop when any file exclusion starts with ` / ` ( [ # 1307 ] ( https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1307 ) )
6
6
7
7
# 0.14.14
8
8
You can’t perform that action at this time.
0 commit comments