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', () => {
177177 expect ( rewriteCss ( input . join ( '\n' ) ) ) . toBe ( output . join ( '\n' ) )
178178} )
179179
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+
180204describe ( 'v3' , ( ) => {
181205 test ( '@screen' , ( ) => {
182206 let input = [
Original file line number Diff line number Diff line change @@ -68,5 +68,13 @@ export function rewriteCss(css: string) {
6868
6969 css = css . replace ( / (?< = \b (?: t h e m e | c o n f i g ) \( [ ^ ) ] * ) [ . [ \] ] / g, '_' )
7070
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+
7179 return css
7280}
Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ defineTest({
218218 @import 'tailwindcss' ;
219219 @theme {
220220 --color-primary : # 333 ;
221+ --leading- * : initial;
221222 }
222223 ` ,
223224 } )
@@ -234,7 +235,7 @@ defineTest({
234235 uri : '{workspace:default}/file-1.css' ,
235236 range : {
236237 start : { line : 1 , character : 0 } ,
237- end : { line : 3 , character : 1 } ,
238+ end : { line : 4 , character : 1 } ,
238239 } ,
239240 } ,
240241 } ,
@@ -351,6 +352,31 @@ defineTest({
351352 } ,
352353} )
353354
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+
354380// Legacy
355381defineTest ( {
356382 name : '@screen' ,
Original file line number Diff line number Diff line change 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 ) )
77- 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 ) )
810
911## 0.14.6
1012
You can’t perform that action at this time.
0 commit comments