@@ -326,6 +326,9 @@ namespace ts {
326326 : FileWatcherEventKind . Changed ;
327327 }
328328
329+ /*@internal */
330+ export const ignoredPaths = [ "/node_modules/." , "/.git" ] ;
331+
329332 /*@internal */
330333 export interface RecursiveDirectoryWatcherHost {
331334 watchDirectory : HostWatchDirectory ;
@@ -371,7 +374,7 @@ namespace ts {
371374 else {
372375 directoryWatcher = {
373376 watcher : host . watchDirectory ( dirName , fileName => {
374- if ( isInNodeModulesStartingWithDot ( fileName ) ) return ;
377+ if ( isIgnoredPath ( fileName ) ) return ;
375378
376379 // Call the actual callback
377380 callbackCache . forEach ( ( callbacks , rootDirName ) => {
@@ -428,7 +431,7 @@ namespace ts {
428431 const childFullName = getNormalizedAbsolutePath ( child , parentDir ) ;
429432 // Filter our the symbolic link directories since those arent included in recursive watch
430433 // which is same behaviour when recursive: true is passed to fs.watch
431- return ! isInNodeModulesStartingWithDot ( childFullName ) && filePathComparer ( childFullName , normalizePath ( host . realpath ( childFullName ) ) ) === Comparison . EqualTo ? childFullName : undefined ;
434+ return ! isIgnoredPath ( childFullName ) && filePathComparer ( childFullName , normalizePath ( host . realpath ( childFullName ) ) ) === Comparison . EqualTo ? childFullName : undefined ;
432435 } ) : emptyArray ,
433436 existingChildWatches ,
434437 ( child , childWatcher ) => filePathComparer ( child , childWatcher . dirName ) ,
@@ -455,8 +458,8 @@ namespace ts {
455458 }
456459 }
457460
458- function isInNodeModulesStartingWithDot ( path : string ) {
459- return isInPath ( path , "/node_modules/." ) ;
461+ function isIgnoredPath ( path : string ) {
462+ return some ( ignoredPaths , searchPath => isInPath ( path , searchPath ) ) ;
460463 }
461464
462465 function isInPath ( path : string , searchPath : string ) {
0 commit comments