Skip to content

Commit 4c5fde4

Browse files
committed
Don’t detect document links for glob-style paths
1 parent 1a46ede commit 4c5fde4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Diff for: packages/tailwindcss-language-server/tests/document-links/document-links.test.js

+9
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,13 @@ withFixture('v4/basic', (c) => {
148148
},
149149
],
150150
})
151+
152+
testDocumentLinks('Globs in source(…) do not show links', {
153+
text: `
154+
@import "tailwindcss" source("../{a,b,c}");
155+
@tailwind utilities source("../{a,b,c}");
156+
`,
157+
lang: 'css',
158+
expected: [],
159+
})
151160
})

Diff for: packages/tailwindcss-language-service/src/documentLinksProvider.ts

+5
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ function getDirectiveLinks(
5454
for (let match of matches) {
5555
let path = match.groups.path.slice(1, -1)
5656

57+
// Ignore glob-like paths
58+
if (path.includes('*') || path.includes('{') || path.includes('}')) {
59+
continue
60+
}
61+
5762
let range = {
5863
start: indexToPosition(text, match.index + match[0].length - match.groups.path.length),
5964
end: indexToPosition(text, match.index + match[0].length),

0 commit comments

Comments
 (0)