Skip to content

Commit

Permalink
Don’t detect document links for glob-style paths
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed Nov 12, 2024
1 parent 9f626f8 commit 78dd585
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 78dd585

Please sign in to comment.