@@ -11,13 +11,14 @@ import type { RepoComparisonKey } from '../../repositories';
1111import { asRepoComparisonKey } from '../../repositories' ;
1212import { executeActionCommand } from '../../system/-webview/command' ;
1313import { configuration } from '../../system/-webview/configuration' ;
14+ import { UriSet } from '../../system/-webview/uriMap' ;
1415import { getScopedCounter } from '../../system/counter' ;
1516import { gate } from '../../system/decorators/-webview/gate' ;
1617import { memoize } from '../../system/decorators/-webview/memoize' ;
1718import { debug , log , logName } from '../../system/decorators/log' ;
1819import type { Deferrable } from '../../system/function/debounce' ;
1920import { debounce } from '../../system/function/debounce' ;
20- import { filter , groupByMap , join , min , some } from '../../system/iterable' ;
21+ import { filter , groupByMap , join , map , min , some } from '../../system/iterable' ;
2122import { getLoggableName , Logger } from '../../system/logger' ;
2223import { getLogScope , startLogScope } from '../../system/logger.scope' ;
2324import { updateRecordValue } from '../../system/object' ;
@@ -139,7 +140,7 @@ export class RepositoryChangeEvent {
139140
140141export interface RepositoryFileSystemChangeEvent {
141142 readonly repository : Repository ;
142- readonly uris : Uri [ ] ;
143+ readonly uris : UriSet ;
143144}
144145
145146const instanceCounter = getScopedCounter ( ) ;
@@ -416,8 +417,8 @@ export class Repository implements Disposable {
416417 }
417418
418419 private onFileSystemChanged ( uri : Uri ) {
419- // Ignore .git changes
420- if ( / \ .g i t (?: \/ | \\ | $ ) / . test ( uri . fsPath ) ) return ;
420+ // Ignore node_modules and .git changes
421+ if ( / (?: (?: \/ | \\ ) n o d e _ m o d u l e s | \ .g i t ) (?: \/ | \\ | $ ) / . test ( uri . fsPath ) ) return ;
421422
422423 this . _etagFileSystem = Date . now ( ) ;
423424 this . fireFileSystemChange ( uri ) ;
@@ -966,12 +967,18 @@ export class Repository implements Disposable {
966967
967968 this . _fireFileSystemChangeDebounced ??= debounce ( this . fireFileSystemChangeCore . bind ( this ) , this . _fsChangeDelay ) ;
968969
969- this . _pendingFileSystemChange ??= { repository : this , uris : [ ] } ;
970+ this . _pendingFileSystemChange ??= { repository : this , uris : new UriSet ( ) } ;
970971 const e = this . _pendingFileSystemChange ;
971- e . uris . push ( uri ) ;
972+ e . uris . add ( uri ) ;
972973
973974 if ( this . _suspended ) {
974- Logger . debug ( scope , `queueing suspended fs changes=${ e . uris . map ( u => u . fsPath ) . join ( ', ' ) } ` ) ;
975+ Logger . debug (
976+ scope ,
977+ `queueing suspended fs changes=${ join (
978+ map ( e . uris , u => u . fsPath ) ,
979+ ', ' ,
980+ ) } `,
981+ ) ;
975982 return ;
976983 }
977984
@@ -984,15 +991,21 @@ export class Repository implements Disposable {
984991
985992 this . _pendingFileSystemChange = undefined ;
986993
987- const uris = await this . git . excludeIgnoredUris ( e . uris ) ;
988- if ( uris . length === 0 ) return ;
994+ const uris = await this . git . excludeIgnoredUris ( [ ... e . uris ] ) ;
995+ if ( ! uris . length ) return ;
989996
990- if ( uris . length !== e . uris . length ) {
991- e = { ...e , uris : uris } ;
997+ if ( uris . length !== e . uris . size ) {
998+ e = { ...e , uris : new UriSet ( uris ) } ;
992999 }
9931000
9941001 using scope = startLogScope ( `${ getLoggableName ( this ) } .fireChangeCore` , false ) ;
995- Logger . debug ( scope , `firing fs changes=${ e . uris . map ( u => u . fsPath ) . join ( ', ' ) } ` ) ;
1002+ Logger . debug (
1003+ scope ,
1004+ `firing fs changes=${ join (
1005+ map ( e . uris , u => u . fsPath ) ,
1006+ ', ' ,
1007+ ) } `,
1008+ ) ;
9961009
9971010 this . _onDidChangeFileSystem . fire ( e ) ;
9981011 }
0 commit comments