@@ -215,9 +215,16 @@ connection.onDocumentSymbol(({ textDocument }) =>
215215 if ( symbol . name === `@media (${ MEDIA_MARKER } )` ) {
216216 let doc = documents . get ( symbol . location . uri )
217217 let text = doc . getText ( symbol . location . range )
218- let match = text . trim ( ) . match ( / ^ ( @ [ ^ \s ] + ) ( [ ^ { ] + ) { / )
218+ let match = text . trim ( ) . match ( / ^ ( @ [ ^ \s ] + ) (?: ( [ ^ { ] + ) [ { ] | ( [ ^ ; { ] + ) ; ) / )
219219 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 ( ) } `
221228 }
222229 }
223230 return symbol
@@ -337,7 +344,7 @@ function replace(delta = 0) {
337344function replaceWithStyleRule ( delta = 0 ) {
338345 return ( _match : string , p1 : string ) => {
339346 let spaces = ' ' . repeat ( p1 . length + delta )
340- return `.foo ${ spaces } {`
347+ return `.placeholder ${ spaces } {`
341348 }
342349}
343350
@@ -354,9 +361,9 @@ function createVirtualCssDocument(textDocument: TextDocument): TextDocument {
354361 . replace ( / @ v a r i a n t s ( \s + [ ^ { ] + ) { / g, replace ( ) )
355362 . replace ( / @ r e s p o n s i v e ( \s * ) { / g, replace ( ) )
356363 . 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 ) => {
358365 let spaces = ' ' . repeat ( match . length - 11 )
359- return `@media(p )${ spaces } {}`
366+ return `@media ( ${ MEDIA_MARKER } )${ spaces } {}`
360367 } )
361368 . replace ( / @ c u s t o m - v a r i a n t ( \s + [ ^ { ] + ) { / g, replaceWithStyleRule ( ) )
362369 . replace ( / @ v a r i a n t ( \s + [ ^ { ] + ) { / g, replaceWithStyleRule ( ) )
0 commit comments