File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -2987,18 +2987,19 @@ namespace ts {
2987
2987
}
2988
2988
2989
2989
/** Remove the *first* occurrence of `item` from the array. */
2990
- export function unorderedRemoveItem < T > ( array : T [ ] , item : T ) : void {
2990
+ export function unorderedRemoveItem < T > ( array : T [ ] , item : T ) {
2991
2991
unorderedRemoveFirstItemWhere ( array , element => element === item ) ;
2992
2992
}
2993
2993
2994
2994
/** Remove the *first* element satisfying `predicate`. */
2995
- function unorderedRemoveFirstItemWhere < T > ( array : T [ ] , predicate : ( element : T ) => boolean ) : void {
2995
+ function unorderedRemoveFirstItemWhere < T > ( array : T [ ] , predicate : ( element : T ) => boolean ) {
2996
2996
for ( let i = 0 ; i < array . length ; i ++ ) {
2997
2997
if ( predicate ( array [ i ] ) ) {
2998
2998
unorderedRemoveItemAt ( array , i ) ;
2999
- break ;
2999
+ return true ;
3000
3000
}
3001
3001
}
3002
+ return false ;
3002
3003
}
3003
3004
3004
3005
export type GetCanonicalFileName = ( fileName : string ) => string ;
Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ namespace ts.server {
92
92
cachedUnresolvedImportsPerFile = createMap < ReadonlyArray < string > > ( ) ;
93
93
/*@internal */
94
94
lastCachedUnresolvedImportsList : SortedReadonlyArray < string > ;
95
+ /*@internal */
96
+ hasMoreOrLessScriptInfos = false ;
95
97
96
98
private lastFileExceededProgramSize : string | undefined ;
97
99
@@ -777,6 +779,8 @@ namespace ts.server {
777
779
this . resolutionCache . startRecordingFilesWithChangedResolutions ( ) ;
778
780
779
781
let hasChanges = this . updateGraphWorker ( ) ;
782
+ const hasMoreOrLessScriptInfos = this . hasMoreOrLessScriptInfos ;
783
+ this . hasMoreOrLessScriptInfos = false ;
780
784
781
785
const changedFiles : ReadonlyArray < Path > = this . resolutionCache . finishRecordingFilesWithChangedResolutions ( ) || emptyArray ;
782
786
@@ -803,7 +807,7 @@ namespace ts.server {
803
807
this . lastCachedUnresolvedImportsList = toDeduplicatedSortedArray ( result ) ;
804
808
}
805
809
806
- const cachedTypings = this . projectService . typingsCache . getTypingsForProject ( this , this . lastCachedUnresolvedImportsList , hasChanges ) ;
810
+ const cachedTypings = this . projectService . typingsCache . getTypingsForProject ( this , this . lastCachedUnresolvedImportsList , hasMoreOrLessScriptInfos ) ;
807
811
if ( ! arrayIsEqualTo ( this . typingFiles , cachedTypings ) ) {
808
812
this . typingFiles = cachedTypings ;
809
813
this . markAsDirty ( ) ;
Original file line number Diff line number Diff line change @@ -304,6 +304,7 @@ namespace ts.server {
304
304
const isNew = ! this . isAttached ( project ) ;
305
305
if ( isNew ) {
306
306
this . containingProjects . push ( project ) ;
307
+ project . hasMoreOrLessScriptInfos = true ;
307
308
if ( ! project . getCompilerOptions ( ) . preserveSymlinks ) {
308
309
this . ensureRealPath ( ) ;
309
310
}
@@ -328,19 +329,24 @@ namespace ts.server {
328
329
return ;
329
330
case 1 :
330
331
if ( this . containingProjects [ 0 ] === project ) {
332
+ project . hasMoreOrLessScriptInfos = true ;
331
333
this . containingProjects . pop ( ) ;
332
334
}
333
335
break ;
334
336
case 2 :
335
337
if ( this . containingProjects [ 0 ] === project ) {
338
+ project . hasMoreOrLessScriptInfos = true ;
336
339
this . containingProjects [ 0 ] = this . containingProjects . pop ( ) ;
337
340
}
338
341
else if ( this . containingProjects [ 1 ] === project ) {
342
+ project . hasMoreOrLessScriptInfos = true ;
339
343
this . containingProjects . pop ( ) ;
340
344
}
341
345
break ;
342
346
default :
343
- unorderedRemoveItem ( this . containingProjects , project ) ;
347
+ if ( unorderedRemoveItem ( this . containingProjects , project ) ) {
348
+ project . hasMoreOrLessScriptInfos = true ;
349
+ }
344
350
break ;
345
351
}
346
352
}
You can’t perform that action at this time.
0 commit comments