File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -503,6 +503,7 @@ namespace ts.server {
503503 // number becomes 0 for a watcher, then we should close it.
504504 directoryWatchersRefCount : ts . Map < number > = { } ;
505505 hostConfiguration : HostConfiguration ;
506+ timerForDetectingProjectFilelistChanges : Map < NodeJS . Timer > = { } ;
506507
507508 constructor ( public host : ServerHost , public psLogger : Logger , public eventHandler ?: ProjectServiceEventHandler ) {
508509 // ts.disableIncrementalParsing = true;
@@ -557,6 +558,20 @@ namespace ts.server {
557558 }
558559
559560 this . log ( "Detected source file changes: " + fileName ) ;
561+ this . startTimerForDetectingProjectFilelistChanges ( project ) ;
562+ }
563+
564+ startTimerForDetectingProjectFilelistChanges ( project : Project ) {
565+ if ( this . timerForDetectingProjectFilelistChanges [ project . projectFilename ] ) {
566+ clearTimeout ( this . timerForDetectingProjectFilelistChanges [ project . projectFilename ] ) ;
567+ }
568+ this . timerForDetectingProjectFilelistChanges [ project . projectFilename ] = setTimeout (
569+ ( ) => this . handleProjectFilelistChanges ( project ) ,
570+ 250
571+ ) ;
572+ }
573+
574+ handleProjectFilelistChanges ( project : Project ) {
560575 let { succeeded, projectOptions, error } = this . configFileToProjectOptions ( project . projectFilename ) ;
561576 let newRootFiles = projectOptions . files . map ( ( f => this . getCanonicalFileName ( f ) ) ) ;
562577 let currentRootFiles = project . getRootFiles ( ) . map ( ( f => this . getCanonicalFileName ( f ) ) ) ;
You can’t perform that action at this time.
0 commit comments