File tree Expand file tree Collapse file tree 4 files changed +61
-1
lines changed
tailwindcss-language-server Expand file tree Collapse file tree 4 files changed +61
-1
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,13 @@ 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
+
76
+ // Replace `--some-var-*` with `--some-var-_`
77
+ css = css . replace ( / - - ( [ a - z A - Z 0 - 9 ] + ) - [ * ] / g, '--$1_' )
78
+
71
79
return css
72
80
}
Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ defineTest({
218
218
@import 'tailwindcss' ;
219
219
@theme {
220
220
--color-primary : # 333 ;
221
+ --leading- * : initial;
221
222
}
222
223
` ,
223
224
} )
@@ -234,7 +235,7 @@ defineTest({
234
235
uri : '{workspace:default}/file-1.css' ,
235
236
range : {
236
237
start : { line : 1 , character : 0 } ,
237
- end : { line : 3 , character : 1 } ,
238
+ end : { line : 4 , character : 1 } ,
238
239
} ,
239
240
} ,
240
241
} ,
@@ -351,6 +352,31 @@ defineTest({
351
352
} ,
352
353
} )
353
354
355
+ defineTest ( {
356
+ name : '--value(namespace) + --modifier(namespace)' ,
357
+ prepare : async ( { root } ) => ( {
358
+ client : await createClient ( {
359
+ server : 'css' ,
360
+ root,
361
+ } ) ,
362
+ } ) ,
363
+ handle : async ( { client } ) => {
364
+ let doc = await client . open ( {
365
+ lang : 'tailwindcss' ,
366
+ name : 'file-1.css' ,
367
+ text : css `
368
+ .foo {
369
+ width : --value (--spacing-* );
370
+ height : --modifier (--spacing-* );
371
+ height : --modifier ([* ]);
372
+ }
373
+ ` ,
374
+ } )
375
+
376
+ expect ( await doc . diagnostics ( ) ) . toEqual ( [ ] )
377
+ } ,
378
+ } )
379
+
354
380
// Legacy
355
381
defineTest ( {
356
382
name : '@screen' ,
Original file line number Diff line number Diff line change 5
5
- LSP: Declare capability for handling workspace folder change notifications ([ #1223 ] ( https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1223 ) )
6
6
- Don't throw when resolving paths containing a ` # ` character ([ #1225 ] ( https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1225 ) )
7
7
- Show ` @theme ` in symbol list in CSS language mode ([ #1227 ] ( https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1227 ) )
8
+ - Don't show syntax error when ` * ` appear inside ` —value(…) ` and ` --modifier(…) ` ([ #1226 ] ( https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1226 ) )
9
+ - Don't show syntax error for theme namespaces inside ` @theme ` ([ #1226 ] ( https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1226 ) )
8
10
9
11
## 0.14.6
10
12
You can’t perform that action at this time.
0 commit comments