Skip to content

Commit 7b6e49d

Browse files
committed
Add document links and completions for @plugin
1 parent 636f192 commit 7b6e49d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/tailwindcss-language-service/src/completionProvider.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,9 @@ async function provideFileDirectiveCompletions(
15361536
return null
15371537
}
15381538

1539-
let pattern = /@config\s*(?<partial>'[^']*|"[^"]*)$/
1539+
let pattern = state.v4
1540+
? /@(config|plugin)\s*(?<partial>'[^']*|"[^"]*)$/
1541+
: /@config\s*(?<partial>'[^']*|"[^"]*)$/
15401542

15411543
let text = document.getText({ start: { line: position.line, character: 0 }, end: position })
15421544
let match = text.match(pattern)

packages/tailwindcss-language-service/src/documentLinksProvider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export function getDocumentLinks(
1717
/@config\s*(?<path>'[^']+'|"[^"]+")/g,
1818
]
1919

20+
if (state.v4) {
21+
patterns.push(
22+
/@plugin\s*(?<path>'[^']+'|"[^"]+")/g,
23+
)
24+
}
25+
2026
return getDirectiveLinks(state, document, patterns, resolveTarget)
2127
}
2228

0 commit comments

Comments
 (0)