@@ -852,46 +852,43 @@ namespace ts.server {
852
852
*/
853
853
updateGraph ( ) : boolean {
854
854
perfLogger . logStartUpdateGraph ( ) ;
855
- try {
856
- this . resolutionCache . startRecordingFilesWithChangedResolutions ( ) ;
857
-
858
- const hasNewProgram = this . updateGraphWorker ( ) ;
859
- const hasAddedorRemovedFiles = this . hasAddedorRemovedFiles ;
860
- this . hasAddedorRemovedFiles = false ;
861
-
862
- const changedFiles : ReadonlyArray < Path > = this . resolutionCache . finishRecordingFilesWithChangedResolutions ( ) || emptyArray ;
863
-
864
- for ( const file of changedFiles ) {
865
- // delete cached information for changed files
866
- this . cachedUnresolvedImportsPerFile . delete ( file ) ;
855
+ this . resolutionCache . startRecordingFilesWithChangedResolutions ( ) ;
856
+
857
+ const hasNewProgram = this . updateGraphWorker ( ) ;
858
+ const hasAddedorRemovedFiles = this . hasAddedorRemovedFiles ;
859
+ this . hasAddedorRemovedFiles = false ;
860
+
861
+ const changedFiles : ReadonlyArray < Path > = this . resolutionCache . finishRecordingFilesWithChangedResolutions ( ) || emptyArray ;
862
+
863
+ for ( const file of changedFiles ) {
864
+ // delete cached information for changed files
865
+ this . cachedUnresolvedImportsPerFile . delete ( file ) ;
866
+ }
867
+
868
+ // update builder only if language service is enabled
869
+ // otherwise tell it to drop its internal state
870
+ if ( this . languageServiceEnabled ) {
871
+ // 1. no changes in structure, no changes in unresolved imports - do nothing
872
+ // 2. no changes in structure, unresolved imports were changed - collect unresolved imports for all files
873
+ // (can reuse cached imports for files that were not changed)
874
+ // 3. new files were added/removed, but compilation settings stays the same - collect unresolved imports for all new/modified files
875
+ // (can reuse cached imports for files that were not changed)
876
+ // 4. compilation settings were changed in the way that might affect module resolution - drop all caches and collect all data from the scratch
877
+ if ( hasNewProgram || changedFiles . length ) {
878
+ this . lastCachedUnresolvedImportsList = getUnresolvedImports ( this . program ! , this . cachedUnresolvedImportsPerFile ) ;
867
879
}
868
880
869
- // update builder only if language service is enabled
870
- // otherwise tell it to drop its internal state
871
- if ( this . languageServiceEnabled ) {
872
- // 1. no changes in structure, no changes in unresolved imports - do nothing
873
- // 2. no changes in structure, unresolved imports were changed - collect unresolved imports for all files
874
- // (can reuse cached imports for files that were not changed)
875
- // 3. new files were added/removed, but compilation settings stays the same - collect unresolved imports for all new/modified files
876
- // (can reuse cached imports for files that were not changed)
877
- // 4. compilation settings were changed in the way that might affect module resolution - drop all caches and collect all data from the scratch
878
- if ( hasNewProgram || changedFiles . length ) {
879
- this . lastCachedUnresolvedImportsList = getUnresolvedImports ( this . program ! , this . cachedUnresolvedImportsPerFile ) ;
880
- }
881
-
882
- this . projectService . typingsCache . enqueueInstallTypingsForProject ( this , this . lastCachedUnresolvedImportsList , hasAddedorRemovedFiles ) ;
883
- }
884
- else {
885
- this . lastCachedUnresolvedImportsList = undefined ;
886
- }
881
+ this . projectService . typingsCache . enqueueInstallTypingsForProject ( this , this . lastCachedUnresolvedImportsList , hasAddedorRemovedFiles ) ;
882
+ }
883
+ else {
884
+ this . lastCachedUnresolvedImportsList = undefined ;
885
+ }
887
886
888
- if ( hasNewProgram ) {
889
- this . projectProgramVersion ++ ;
890
- }
891
- return ! hasNewProgram ;
892
- } finally {
893
- perfLogger . logStopUpdateGraph ( ) ;
887
+ if ( hasNewProgram ) {
888
+ this . projectProgramVersion ++ ;
894
889
}
890
+ perfLogger . logStopUpdateGraph ( ) ;
891
+ return ! hasNewProgram ;
895
892
}
896
893
897
894
/*@internal */
0 commit comments