File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -507,6 +507,7 @@ namespace ts {
507
507
const configFileCache = createConfigFileCache ( host ) ;
508
508
let context = createBuildContext ( defaultOptions ) ;
509
509
let timerToBuildInvalidatedProject : any ;
510
+ let reportFileChangeDetected = false ;
510
511
511
512
const existingWatchersForWildcards = createMap < WildcardDirectoryWatcher > ( ) ;
512
513
return {
@@ -584,7 +585,7 @@ namespace ts {
584
585
}
585
586
586
587
function invalidateProjectAndScheduleBuilds ( resolved : ResolvedConfigFileName ) {
587
- reportWatchStatus ( Diagnostics . File_change_detected_Starting_incremental_compilation ) ;
588
+ reportFileChangeDetected = true ;
588
589
invalidateProject ( resolved ) ;
589
590
scheduleBuildInvalidatedProject ( ) ;
590
591
}
@@ -817,6 +818,10 @@ namespace ts {
817
818
818
819
function buildInvalidatedProject ( ) {
819
820
timerToBuildInvalidatedProject = undefined ;
821
+ if ( reportFileChangeDetected ) {
822
+ reportFileChangeDetected = false ;
823
+ reportWatchStatus ( Diagnostics . File_change_detected_Starting_incremental_compilation ) ;
824
+ }
820
825
const buildProject = context . getNextInvalidatedProject ( ) ;
821
826
buildSomeProjects ( p => p === buildProject ) ;
822
827
if ( context . hasPendingInvalidatedProjects ( ) ) {
Original file line number Diff line number Diff line change @@ -112,9 +112,22 @@ export class someClass { }`);
112
112
// Another change requeues and builds it
113
113
verifyChange ( core [ 1 ] . content ) ;
114
114
115
+ // Two changes together report only single time message: File change detected. Starting incremental compilation...
116
+ const outputFileStamps = getOutputFileStamps ( host ) ;
117
+ const change1 = `${ core [ 1 ] . content }
118
+ export class someClass { }` ;
119
+ host . writeFile ( core [ 1 ] . path , change1 ) ;
120
+ host . writeFile ( core [ 1 ] . path , `${ change1 }
121
+ export class someClass2 { }` ) ;
122
+ verifyChangeAfterTimeout ( outputFileStamps ) ;
123
+
115
124
function verifyChange ( coreContent : string ) {
116
125
const outputFileStamps = getOutputFileStamps ( host ) ;
117
126
host . writeFile ( core [ 1 ] . path , coreContent ) ;
127
+ verifyChangeAfterTimeout ( outputFileStamps ) ;
128
+ }
129
+
130
+ function verifyChangeAfterTimeout ( outputFileStamps : OutputFileStamp [ ] ) {
118
131
host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Builds core
119
132
const changedCore = getOutputFileStamps ( host ) ;
120
133
verifyChangedFiles ( changedCore , outputFileStamps , [
You can’t perform that action at this time.
0 commit comments