@@ -318,12 +318,6 @@ export class ExplorerItem {
318
318
319
319
const items : ExplorerItem [ ] = [ ] ;
320
320
if ( nestingConfig . enabled ) {
321
- const patterns = Object . entries ( nestingConfig . patterns ) . map (
322
- ( [ parentPattern , childrenPatterns ] ) =>
323
- [ parentPattern . trim ( ) , childrenPatterns . split ( ',' ) . map ( p => p . trim ( ) ) ] as [ string , string [ ] ] ) ;
324
-
325
- const nester = new ExplorerFileNestingTrie ( patterns ) ;
326
-
327
321
const fileChildren : [ string , ExplorerItem ] [ ] = [ ] ;
328
322
const dirChildren : [ string , ExplorerItem ] [ ] = [ ] ;
329
323
for ( const child of this . children . entries ( ) ) {
@@ -334,7 +328,7 @@ export class ExplorerItem {
334
328
}
335
329
}
336
330
337
- const nested = nester . nest ( fileChildren . map ( ( [ name ] ) => name ) ) ;
331
+ const nested = this . buildFileNester ( ) . nest ( fileChildren . map ( ( [ name ] ) => name ) ) ;
338
332
339
333
for ( const [ fileEntryName , fileEntryItem ] of fileChildren ) {
340
334
const nestedItems = nested . get ( fileEntryName ) ;
@@ -361,6 +355,18 @@ export class ExplorerItem {
361
355
return items ;
362
356
}
363
357
358
+ // TODO:@jkearl , share one nester across all explorer items and only build on config change
359
+ private buildFileNester ( ) : ExplorerFileNestingTrie {
360
+ const nestingConfig = this . configService . getValue < IFilesConfiguration > ( ) . explorer . experimental . fileNesting ;
361
+ const patterns = Object . entries ( nestingConfig . patterns )
362
+ . filter ( entry =>
363
+ typeof ( entry [ 0 ] ) === 'string' && typeof ( entry [ 1 ] ) === 'string' && entry [ 0 ] && entry [ 1 ] )
364
+ . map ( ( [ parentPattern , childrenPatterns ] ) =>
365
+ [ parentPattern . trim ( ) , childrenPatterns . split ( ',' ) . map ( p => p . trim ( ) ) ] as [ string , string [ ] ] ) ;
366
+
367
+ return new ExplorerFileNestingTrie ( patterns ) ;
368
+ }
369
+
364
370
/**
365
371
* Removes a child element from this folder.
366
372
*/
0 commit comments