@@ -543,33 +543,32 @@ namespace ts.server {
543
543
this . cachedUnresolvedImportsPerFile . remove ( file ) ;
544
544
}
545
545
546
- // 1. no changes in structure, no changes in unresolved imports - do nothing
547
- // 2. no changes in structure, unresolved imports were changed - collect unresolved imports for all files
548
- // (can reuse cached imports for files that were not changed)
549
- // 3. new files were added/removed, but compilation settings stays the same - collect unresolved imports for all new/modified files
550
- // (can reuse cached imports for files that were not changed)
551
- // 4. compilation settings were changed in the way that might affect module resolution - drop all caches and collect all data from the scratch
552
- let unresolvedImports : SortedReadonlyArray < string > ;
553
- if ( hasChanges || changedFiles . length ) {
554
- const result : string [ ] = [ ] ;
555
- for ( const sourceFile of this . program . getSourceFiles ( ) ) {
556
- this . extractUnresolvedImportsFromSourceFile ( sourceFile , result ) ;
557
- }
558
- this . lastCachedUnresolvedImportsList = toDeduplicatedSortedArray ( result ) ;
559
- }
560
- unresolvedImports = this . lastCachedUnresolvedImportsList ;
561
-
562
- const cachedTypings = this . projectService . typingsCache . getTypingsForProject ( this , unresolvedImports , hasChanges ) ;
563
- if ( this . setTypings ( cachedTypings ) ) {
564
- hasChanges = this . updateGraphWorker ( ) || hasChanges ;
565
- }
566
-
567
546
// update builder only if language service is enabled
568
547
// otherwise tell it to drop its internal state
569
548
if ( this . languageServiceEnabled ) {
549
+ // 1. no changes in structure, no changes in unresolved imports - do nothing
550
+ // 2. no changes in structure, unresolved imports were changed - collect unresolved imports for all files
551
+ // (can reuse cached imports for files that were not changed)
552
+ // 3. new files were added/removed, but compilation settings stays the same - collect unresolved imports for all new/modified files
553
+ // (can reuse cached imports for files that were not changed)
554
+ // 4. compilation settings were changed in the way that might affect module resolution - drop all caches and collect all data from the scratch
555
+ if ( hasChanges || changedFiles . length ) {
556
+ const result : string [ ] = [ ] ;
557
+ for ( const sourceFile of this . program . getSourceFiles ( ) ) {
558
+ this . extractUnresolvedImportsFromSourceFile ( sourceFile , result ) ;
559
+ }
560
+ this . lastCachedUnresolvedImportsList = toDeduplicatedSortedArray ( result ) ;
561
+ }
562
+
563
+ const cachedTypings = this . projectService . typingsCache . getTypingsForProject ( this , this . lastCachedUnresolvedImportsList , hasChanges ) ;
564
+ if ( this . setTypings ( cachedTypings ) ) {
565
+ hasChanges = this . updateGraphWorker ( ) || hasChanges ;
566
+ }
567
+
570
568
this . builder . onProjectUpdateGraph ( ) ;
571
569
}
572
570
else {
571
+ this . lastCachedUnresolvedImportsList = undefined ;
573
572
this . builder . clear ( ) ;
574
573
}
575
574
0 commit comments