File tree Expand file tree Collapse file tree 4 files changed +66
-0
lines changed
tailwindcss-language-server Expand file tree Collapse file tree 4 files changed +66
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,30 @@ test('@utility', () => {
6565 expect ( rewriteCss ( input . join ( '\n' ) ) ) . toBe ( output . join ( '\n' ) )
6666} )
6767
68+ test ( '@theme' , ( ) => {
69+ let input = [
70+ //
71+ '@theme {' ,
72+ ' color: red;' ,
73+ '}' ,
74+ '@theme inline reference static default {' ,
75+ ' color: red;' ,
76+ '}' ,
77+ ]
78+
79+ let output = [
80+ //
81+ '.placeholder {' , // wrong
82+ ' color: red;' ,
83+ '}' ,
84+ '.placeholder {' , // wrong
85+ ' color: red;' ,
86+ '}' ,
87+ ]
88+
89+ expect ( rewriteCss ( input . join ( '\n' ) ) ) . toBe ( output . join ( '\n' ) )
90+ } )
91+
6892test ( '@custom-variant' , ( ) => {
6993 let input = [
7094 //
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export function rewriteCss(css: string) {
3737 css = css . replace ( / @ v a r i a n t s ( \s + [ ^ { ] + ) { / g, replaceWithAtRule ( ) )
3838 css = css . replace ( / @ r e s p o n s i v e ( \s * ) { / g, replaceWithAtRule ( ) )
3939 css = css . replace ( / @ u t i l i t y ( \s + [ ^ { ] + ) { / g, replaceWithStyleRule ( ) )
40+ css = css . replace ( / @ t h e m e ( \s + [ ^ { ] * ) { / g, replaceWithStyleRule ( ) )
4041
4142 css = css . replace ( / @ c u s t o m - v a r i a n t ( \s + [ ^ ; { ] + ) ; / g, ( match : string ) => {
4243 let spaces = ' ' . repeat ( match . length - 11 )
Original file line number Diff line number Diff line change @@ -202,6 +202,46 @@ defineTest({
202202 } ,
203203} )
204204
205+ defineTest ( {
206+ name : '@theme' ,
207+ prepare : async ( { root } ) => ( {
208+ client : await createClient ( {
209+ server : 'css' ,
210+ root,
211+ } ) ,
212+ } ) ,
213+ handle : async ( { client } ) => {
214+ let doc = await client . open ( {
215+ lang : 'tailwindcss' ,
216+ name : 'file-1.css' ,
217+ text : css `
218+ @import 'tailwindcss' ;
219+ @theme {
220+ --color-primary : # 333 ;
221+ }
222+ ` ,
223+ } )
224+
225+ // No errors
226+ expect ( await doc . diagnostics ( ) ) . toEqual ( [ ] )
227+
228+ // Symbols show up for @theme
229+ expect ( await doc . symbols ( ) ) . toMatchObject ( [
230+ {
231+ kind : SymbolKind . Class ,
232+ name : '@theme ' ,
233+ location : {
234+ uri : '{workspace:default}/file-1.css' ,
235+ range : {
236+ start : { line : 1 , character : 0 } ,
237+ end : { line : 3 , character : 1 } ,
238+ } ,
239+ } ,
240+ } ,
241+ ] )
242+ } ,
243+ } )
244+
205245defineTest ( {
206246 name : '@layer statement' ,
207247 prepare : async ( { root } ) => ( {
Original file line number Diff line number Diff line change 44
55- LSP: Declare capability for handling workspace folder change notifications ([ #1223 ] ( https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1223 ) )
66- Don't throw when resolving paths containing a ` # ` character ([ #1225 ] ( https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1225 ) )
7+ - Show ` @theme ` in symbol list in CSS language mode ([ #1227 ] ( https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1227 ) )
78
89## 0.14.6
910
You can’t perform that action at this time.
0 commit comments