@@ -168,36 +168,40 @@ async function provideSourceGlobHover(
168168
169169 let text = getTextWithoutComments ( document , 'css' , range )
170170
171- let pattern = / @ s o u r c e (?: \s + n o t ) ? \s * (?< path > ' [ ^ ' ] + ' | " [ ^ " ] + " ) / dg
171+ let patterns = [
172+ / @ s o u r c e (?: \s + n o t ) ? \s * (?< glob > ' [ ^ ' ] + ' | " [ ^ " ] + " ) / dg,
173+ ]
172174
173- for ( let match of findAll ( pattern , text ) ) {
174- let path = match . groups . path . slice ( 1 , - 1 )
175+ let matches = patterns . flatMap ( ( pattern ) => findAll ( pattern , text ) )
175176
176- // Ignore paths that don't need brace expansion
177- if ( ! path . includes ( '{' ) || ! path . includes ( '}' ) ) continue
177+ for ( let match of matches ) {
178+ let glob = match . groups . glob . slice ( 1 , - 1 )
179+
180+ // Ignore globs that don't need brace expansion
181+ if ( ! glob . includes ( '{' ) || ! glob . includes ( '}' ) ) continue
178182
179- // Ignore paths that don't contain the current position
183+ // Ignore glob that don't contain the current position
180184 let slice : Range = absoluteRange (
181185 {
182- start : indexToPosition ( text , match . indices . groups . path [ 0 ] ) ,
183- end : indexToPosition ( text , match . indices . groups . path [ 1 ] ) ,
186+ start : indexToPosition ( text , match . indices . groups . glob [ 0 ] ) ,
187+ end : indexToPosition ( text , match . indices . groups . glob [ 1 ] ) ,
184188 } ,
185189 range ,
186190 )
187191
188192 if ( ! isWithinRange ( position , slice ) ) continue
189193
190194 // Perform brace expansion
191- let paths = new Set ( braces . expand ( path ) )
192- if ( paths . size < 2 ) continue
195+ let expanded = new Set ( braces . expand ( glob ) )
196+ if ( expanded . size < 2 ) continue
193197
194198 return {
195199 range : slice ,
196200 contents : markdown ( [
197201 //
198202 '**Expansion**' ,
199203 '```plaintext' ,
200- ...Array . from ( paths , ( path ) => `- ${ path } ` ) ,
204+ ...Array . from ( expanded , ( entry ) => `- ${ entry } ` ) ,
201205 '```' ,
202206 ] ) ,
203207 }
0 commit comments