@@ -283,7 +283,7 @@ namespace ts.server {
283283 return true ;
284284 }
285285 let hasChanges = this . updateGraphWorker ( ) ;
286- const cachedTypings = this . projectService . typingsCache . getTypingsForProject ( this ) ;
286+ const cachedTypings = this . projectService . typingsCache . getTypingsForProject ( this , hasChanges ) ;
287287 if ( this . setTypings ( cachedTypings ) ) {
288288 hasChanges = this . updateGraphWorker ( ) || hasChanges ;
289289 }
@@ -312,7 +312,6 @@ namespace ts.server {
312312 // - newProgram is different from the old program and structure of the old program was not reused.
313313 if ( ! oldProgram || ( this . program !== oldProgram && ! oldProgram . structureIsReused ) ) {
314314 hasChanges = true ;
315- //this.projectService.typingsCache.invalidateCachedTypingsForProject(this);
316315 if ( oldProgram ) {
317316 for ( const f of oldProgram . getSourceFiles ( ) ) {
318317 if ( this . program . getSourceFileByPath ( f . path ) ) {
@@ -405,27 +404,16 @@ namespace ts.server {
405404
406405 const added : string [ ] = [ ] ;
407406 const removed : string [ ] = [ ] ;
408- let invalidateTypings = false ;
409407 for ( const id in currentFiles ) {
410- if ( hasProperty ( currentFiles , id ) && ! hasProperty ( lastReportedFileNames , id ) ) {
408+ if ( ! hasProperty ( lastReportedFileNames , id ) ) {
411409 added . push ( id ) ;
412- if ( this . typingFiles . indexOf ( id ) < 0 ) {
413- invalidateTypings = true ;
414- break ;
415- }
416410 }
417411 }
418412 for ( const id in lastReportedFileNames ) {
419- if ( hasProperty ( lastReportedFileNames , id ) && ! hasProperty ( currentFiles , id ) ) {
413+ if ( ! hasProperty ( currentFiles , id ) ) {
420414 removed . push ( id ) ;
421- invalidateTypings = true ;
422415 }
423416 }
424- if ( invalidateTypings ) {
425- this . projectService . typingsCache . invalidateCachedTypingsForProject ( this ) ;
426- }
427- this . lastReportedFileNames = currentFiles ;
428-
429417 this . lastReportedFileNames = currentFiles ;
430418 this . lastReportedVersion = this . projectStructureVersion ;
431419 return { info, changes : { added, removed } , projectErrors : this . projectErrors } ;
0 commit comments