Skip to content

Commit dd673ab

Browse files
Fix parsing of @custom-variant shorthand in Tailwind CSS language mode (#1183)
Fixes #1180
1 parent d32a3ed commit dd673ab

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

packages/tailwindcss-language-server/src/language/cssServer.ts

+4
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,10 @@ function createVirtualCssDocument(textDocument: TextDocument): TextDocument {
354354
.replace(/@variants(\s+[^{]+){/g, replace())
355355
.replace(/@responsive(\s*){/g, replace())
356356
.replace(/@utility(\s+[^{]+){/g, replaceWithStyleRule())
357+
.replace(/@custom-variant(\s+[^;]+);/g, (match: string) => {
358+
let spaces = ' '.repeat(match.length - 11)
359+
return `@media(p)${spaces}{}`
360+
})
357361
.replace(/@custom-variant(\s+[^{]+){/g, replaceWithStyleRule())
358362
.replace(/@variant(\s+[^{]+){/g, replaceWithStyleRule())
359363
.replace(/@layer(\s+[^{]{2,}){/g, replace(-3))

packages/vscode-tailwindcss/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Treat `<script lang=“tsx”>` as containing JSX ([#1175](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1175))
77
- Add support for `static` theme option ([#1176](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1176))
88
- Add details about theme options when hovering ([#1176](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1176))
9+
- Fix parsing of `@custom-variant` shorthand in Tailwind CSS language mode ([#1183](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1183))
910

1011
## 0.14.3
1112

0 commit comments

Comments
 (0)