File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed
packages/tailwindcss-language-server Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,30 @@ test('@import', () => {
177
177
expect ( rewriteCss ( input . join ( '\n' ) ) ) . toBe ( output . join ( '\n' ) )
178
178
} )
179
179
180
+ test ( '--value(namespace) / --modifier(namespace)' , ( ) => {
181
+ let input = [
182
+ //
183
+ '.foo {' ,
184
+ ' color: --value(--color-*)' ,
185
+ ' background: --modifier(--color-*)' ,
186
+ ' z-index: --value([*])' ,
187
+ ' z-index: --modifier([*])' ,
188
+ '}' ,
189
+ ]
190
+
191
+ let output = [
192
+ //
193
+ '.foo {' ,
194
+ ' color: --value(--color-_)' ,
195
+ ' background: --modifier(--color-_)' ,
196
+ ' z-index: --value([_])' ,
197
+ ' z-index: --modifier([_])' ,
198
+ '}' ,
199
+ ]
200
+
201
+ expect ( rewriteCss ( input . join ( '\n' ) ) ) . toBe ( output . join ( '\n' ) )
202
+ } )
203
+
180
204
describe ( 'v3' , ( ) => {
181
205
test ( '@screen' , ( ) => {
182
206
let input = [
Original file line number Diff line number Diff line change @@ -68,5 +68,10 @@ export function rewriteCss(css: string) {
68
68
69
69
css = css . replace ( / (?< = \b (?: t h e m e | c o n f i g ) \( [ ^ ) ] * ) [ . [ \] ] / g, '_' )
70
70
71
+ // Ignore `*` in in --value and --modifier functions
72
+ css = css . replace ( / - - ( v a l u e | m o d i f i e r ) \( ( .* ?) \) / g, ( match ) => {
73
+ return match . replace ( / [ * ] / g, '_' )
74
+ } )
75
+
71
76
return css
72
77
}
Original file line number Diff line number Diff line change @@ -351,6 +351,31 @@ defineTest({
351
351
} ,
352
352
} )
353
353
354
+ defineTest ( {
355
+ name : '--value(namespace) + --modifier(namespace)' ,
356
+ prepare : async ( { root } ) => ( {
357
+ client : await createClient ( {
358
+ server : 'css' ,
359
+ root,
360
+ } ) ,
361
+ } ) ,
362
+ handle : async ( { client } ) => {
363
+ let doc = await client . open ( {
364
+ lang : 'tailwindcss' ,
365
+ name : 'file-1.css' ,
366
+ text : css `
367
+ .foo {
368
+ width : --value (--spacing-* );
369
+ height : --modifier (--spacing-* );
370
+ height : --modifier ([* ]);
371
+ }
372
+ ` ,
373
+ } )
374
+
375
+ expect ( await doc . diagnostics ( ) ) . toEqual ( [ ] )
376
+ } ,
377
+ } )
378
+
354
379
// Legacy
355
380
defineTest ( {
356
381
name : '@screen' ,
You can’t perform that action at this time.
0 commit comments