@@ -17,6 +17,7 @@ namespace ts.server {
1717 readonly typingOptions : TypingOptions ;
1818 readonly compilerOptions : CompilerOptions ;
1919 readonly typings : TypingsArray ;
20+ readonly files : string [ ] ;
2021 poisoned : boolean ;
2122 }
2223
@@ -73,6 +74,10 @@ namespace ts.server {
7374 return opt1 . allowJs != opt2 . allowJs ;
7475 }
7576
77+ function filesChanged ( before : string [ ] , after : string [ ] ) : boolean {
78+ return ! setIsEqualTo ( before , after ) ;
79+ }
80+
7681 export interface TypingsArray extends ReadonlyArray < string > {
7782 " __typingsArrayBrand" : any ;
7883 }
@@ -97,7 +102,7 @@ namespace ts.server {
97102
98103 const entry = this . perProjectCache [ project . getProjectName ( ) ] ;
99104 const result : TypingsArray = entry ? entry . typings : < any > emptyArray ;
100- if ( ! entry || typingOptionsChanged ( typingOptions , entry . typingOptions ) || compilerOptionsChanged ( project . getCompilerOptions ( ) , entry . compilerOptions ) ) {
105+ if ( ! entry || typingOptionsChanged ( typingOptions , entry . typingOptions ) || compilerOptionsChanged ( project . getCompilerOptions ( ) , entry . compilerOptions ) || filesChanged ( project . getFileNames ( ) , entry . files ) ) {
101106 // something has been changed, issue a request to update typings
102107 this . installer . enqueueInstallTypingsRequest ( project , typingOptions ) ;
103108 // Note: entry is now poisoned since it does not really contain typings for a given combination of compiler options\typings options.
@@ -106,6 +111,7 @@ namespace ts.server {
106111 compilerOptions : project . getCompilerOptions ( ) ,
107112 typingOptions,
108113 typings : result ,
114+ files : project . getFileNames ( ) ,
109115 poisoned : true
110116 } ;
111117 }
@@ -120,11 +126,12 @@ namespace ts.server {
120126 this . installer . enqueueInstallTypingsRequest ( project , typingOptions ) ;
121127 }
122128
123- updateTypingsForProject ( projectName : string , compilerOptions : CompilerOptions , typingOptions : TypingOptions , newTypings : string [ ] ) {
129+ updateTypingsForProject ( projectName : string , compilerOptions : CompilerOptions , typingOptions : TypingOptions , newTypings : string [ ] , files : string [ ] ) {
124130 this . perProjectCache [ projectName ] = {
125131 compilerOptions,
126132 typingOptions,
127133 typings : toTypingsArray ( newTypings ) ,
134+ files : files ,
128135 poisoned : false
129136 } ;
130137 }
0 commit comments