@@ -215,9 +215,16 @@ connection.onDocumentSymbol(({ textDocument }) =>
215
215
if ( symbol . name === `@media (${ MEDIA_MARKER } )` ) {
216
216
let doc = documents . get ( symbol . location . uri )
217
217
let text = doc . getText ( symbol . location . range )
218
- let match = text . trim ( ) . match ( / ^ ( @ [ ^ \s ] + ) ( [ ^ { ] + ) { / )
218
+ let match = text . trim ( ) . match ( / ^ ( @ [ ^ \s ] + ) (?: ( [ ^ { ] + ) [ { ] | ( [ ^ ; { ] + ) ; ) / )
219
219
if ( match ) {
220
- symbol . name = `${ match [ 1 ] } ${ match [ 2 ] . trim ( ) } `
220
+ symbol . name = `${ match [ 1 ] } ${ match [ 2 ] ?. trim ( ) ?? match [ 3 ] ?. trim ( ) } `
221
+ }
222
+ } else if ( symbol . name === `.placeholder` ) {
223
+ let doc = documents . get ( symbol . location . uri )
224
+ let text = doc . getText ( symbol . location . range )
225
+ let match = text . trim ( ) . match ( / ^ ( @ [ ^ \s ] + ) (?: ( [ ^ { ] + ) [ { ] | ( [ ^ ; { ] + ) ; ) / )
226
+ if ( match ) {
227
+ symbol . name = `${ match [ 1 ] } ${ match [ 2 ] ?. trim ( ) ?? match [ 3 ] ?. trim ( ) } `
221
228
}
222
229
}
223
230
return symbol
@@ -337,7 +344,7 @@ function replace(delta = 0) {
337
344
function replaceWithStyleRule ( delta = 0 ) {
338
345
return ( _match : string , p1 : string ) => {
339
346
let spaces = ' ' . repeat ( p1 . length + delta )
340
- return `.foo ${ spaces } {`
347
+ return `.placeholder ${ spaces } {`
341
348
}
342
349
}
343
350
@@ -354,9 +361,9 @@ function createVirtualCssDocument(textDocument: TextDocument): TextDocument {
354
361
. replace ( / @ v a r i a n t s ( \s + [ ^ { ] + ) { / g, replace ( ) )
355
362
. replace ( / @ r e s p o n s i v e ( \s * ) { / g, replace ( ) )
356
363
. replace ( / @ u t i l i t y ( \s + [ ^ { ] + ) { / g, replaceWithStyleRule ( ) )
357
- . replace ( / @ c u s t o m - v a r i a n t ( \s + [ ^ ; ] + ) ; / g, ( match : string ) => {
364
+ . replace ( / @ c u s t o m - v a r i a n t ( \s + [ ^ ; { ] + ) ; / g, ( match : string ) => {
358
365
let spaces = ' ' . repeat ( match . length - 11 )
359
- return `@media(p )${ spaces } {}`
366
+ return `@media ( ${ MEDIA_MARKER } )${ spaces } {}`
360
367
} )
361
368
. replace ( / @ c u s t o m - v a r i a n t ( \s + [ ^ { ] + ) { / g, replaceWithStyleRule ( ) )
362
369
. replace ( / @ v a r i a n t ( \s + [ ^ { ] + ) { / g, replaceWithStyleRule ( ) )
0 commit comments