Skip to content

Fix infinite loop when any file exclusions start with / #1307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for file exclusions starting with /
  • Loading branch information
thecrypticace committed Apr 9, 2025
commit 0ab7a1007c44585ce5a77bc3efa727ab6c6cb6c8
37 changes: 37 additions & 0 deletions packages/tailwindcss-language-server/src/project-locator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,43 @@ testLocator({
],
})

testLocator({
name: 'File exclusions starting with `/` do not cause traversal to loop forever',
fs: {
'index.css': css`
@import 'tailwindcss';
`,
'vendor/a.css': css`
@import 'tailwindcss';
`,
'vendor/nested/b.css': css`
@import 'tailwindcss';
`,
'src/vendor/c.css': css`
@import 'tailwindcss';
`,
},
settings: {
tailwindCSS: {
files: {
exclude: ['/vendor'],
},
} as Settings['tailwindCSS'],
},
expected: [
{
version: '4.1.1 (bundled)',
config: '/index.css',
content: [],
},
{
version: '4.1.1 (bundled)',
config: '/src/vendor/c.css',
content: [],
},
],
})

// ---

function testLocator({
Expand Down