diff --git a/packages/tailwindcss-language-server/tests/document-links/document-links.test.js b/packages/tailwindcss-language-server/tests/document-links/document-links.test.js index 39c1d801..2c272bfb 100644 --- a/packages/tailwindcss-language-server/tests/document-links/document-links.test.js +++ b/packages/tailwindcss-language-server/tests/document-links/document-links.test.js @@ -148,4 +148,13 @@ withFixture('v4/basic', (c) => { }, ], }) + + testDocumentLinks('Globs in source(…) do not show links', { + text: ` + @import "tailwindcss" source("../{a,b,c}"); + @tailwind utilities source("../{a,b,c}"); + `, + lang: 'css', + expected: [], + }) }) diff --git a/packages/tailwindcss-language-service/src/documentLinksProvider.ts b/packages/tailwindcss-language-service/src/documentLinksProvider.ts index 06401059..6397fdb9 100644 --- a/packages/tailwindcss-language-service/src/documentLinksProvider.ts +++ b/packages/tailwindcss-language-service/src/documentLinksProvider.ts @@ -54,6 +54,11 @@ function getDirectiveLinks( for (let match of matches) { let path = match.groups.path.slice(1, -1) + // Ignore glob-like paths + if (path.includes('*') || path.includes('{') || path.includes('}')) { + continue + } + let range = { start: indexToPosition(text, match.index + match[0].length - match.groups.path.length), end: indexToPosition(text, match.index + match[0].length),