File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ namespace ts {
54
54
writeLog ( s : string ) : void ;
55
55
maxNumberOfFilesToIterateForInvalidation ?: number ;
56
56
getCurrentProgram ( ) : Program | undefined ;
57
+ fileIsOpen ( filePath : Path ) : boolean ;
57
58
}
58
59
59
60
interface DirectoryWatchesOfFailedLookup {
@@ -713,6 +714,10 @@ namespace ts {
713
714
if ( ! isPathWithDefaultFailedLookupExtension ( fileOrDirectoryPath ) && ! customFailedLookupPaths . has ( fileOrDirectoryPath ) ) {
714
715
return false ;
715
716
}
717
+ // prevent saving an open file from over-eagerly triggering invalidation
718
+ if ( resolutionHost . fileIsOpen ( fileOrDirectoryPath ) ) {
719
+ return ;
720
+ }
716
721
// Ignore emits from the program
717
722
if ( isEmittedFileOfProgram ( resolutionHost . getCurrentProgram ( ) , fileOrDirectoryPath ) ) {
718
723
return false ;
Original file line number Diff line number Diff line change @@ -691,6 +691,7 @@ namespace ts {
691
691
hasChangedAutomaticTypeDirectiveNames = true ;
692
692
scheduleProgramUpdate ( ) ;
693
693
} ;
694
+ compilerHost . fileIsOpen = ( ) => false ;
694
695
compilerHost . maxNumberOfFilesToIterateForInvalidation = host . maxNumberOfFilesToIterateForInvalidation ;
695
696
compilerHost . getCurrentProgram = getCurrentProgram ;
696
697
compilerHost . writeLog = writeLog ;
Original file line number Diff line number Diff line change @@ -457,6 +457,11 @@ namespace ts.server {
457
457
return this . getTypeAcquisition ( ) . enable ? this . projectService . typingsInstaller . globalTypingsCacheLocation : undefined ;
458
458
}
459
459
460
+ /*@internal */
461
+ fileIsOpen ( filePath : Path ) {
462
+ return this . projectService . openFiles . has ( filePath ) ;
463
+ }
464
+
460
465
/*@internal */
461
466
writeLog ( s : string ) {
462
467
this . projectService . logger . info ( s ) ;
You can’t perform that action at this time.
0 commit comments