@@ -323,6 +323,7 @@ namespace ts.server {
323
323
cancellationToken : HostCancellationToken ;
324
324
useSingleInferredProject : boolean ;
325
325
useInferredProjectPerProjectRoot : boolean ;
326
+ lazyConfiguredProjectsFromExternalProject ?: boolean ;
326
327
typingsInstaller : ITypingsInstaller ;
327
328
eventHandler ?: ProjectServiceEventHandler ;
328
329
suppressDiagnosticEvents ?: boolean ;
@@ -440,6 +441,7 @@ namespace ts.server {
440
441
public readonly cancellationToken : HostCancellationToken ;
441
442
public readonly useSingleInferredProject : boolean ;
442
443
public readonly useInferredProjectPerProjectRoot : boolean ;
444
+ private readonly lazyConfiguredProjectsFromExternalProject ?: boolean ;
443
445
public readonly typingsInstaller : ITypingsInstaller ;
444
446
private readonly globalCacheLocationDirectoryPath : Path | undefined ;
445
447
public readonly throttleWaitMilliseconds ?: number ;
@@ -465,6 +467,7 @@ namespace ts.server {
465
467
this . cancellationToken = opts . cancellationToken ;
466
468
this . useSingleInferredProject = opts . useSingleInferredProject ;
467
469
this . useInferredProjectPerProjectRoot = opts . useInferredProjectPerProjectRoot ;
470
+ this . lazyConfiguredProjectsFromExternalProject = opts . lazyConfiguredProjectsFromExternalProject ;
468
471
this . typingsInstaller = opts . typingsInstaller || nullTypingsInstaller ;
469
472
this . throttleWaitMilliseconds = opts . throttleWaitMilliseconds ;
470
473
this . eventHandler = opts . eventHandler ;
@@ -1561,6 +1564,13 @@ namespace ts.server {
1561
1564
return project ;
1562
1565
}
1563
1566
1567
+ /* @internal */
1568
+ private createLoadAndUpdateConfiguredProject ( configFileName : NormalizedPath ) {
1569
+ const project = this . createAndLoadConfiguredProject ( configFileName ) ;
1570
+ project . updateGraph ( ) ;
1571
+ return project ;
1572
+ }
1573
+
1564
1574
/**
1565
1575
* Read the config file of the project, and update the project root file names.
1566
1576
*/
@@ -2192,8 +2202,7 @@ namespace ts.server {
2192
2202
if ( configFileName ) {
2193
2203
project = this . findConfiguredProjectByProjectName ( configFileName ) ;
2194
2204
if ( ! project ) {
2195
- project = this . createAndLoadConfiguredProject ( configFileName ) ;
2196
- project . updateGraph ( ) ;
2205
+ project = this . createLoadAndUpdateConfiguredProject ( configFileName ) ;
2197
2206
// Send the event only if the project got created as part of this open request and info is part of the project
2198
2207
if ( info . isOrphan ( ) ) {
2199
2208
// Since the file isnt part of configured project, do not send config file info
@@ -2633,7 +2642,9 @@ namespace ts.server {
2633
2642
let project = this . findConfiguredProjectByProjectName ( tsconfigFile ) ;
2634
2643
if ( ! project ) {
2635
2644
// errors are stored in the project, do not need to update the graph
2636
- project = this . createConfiguredProjectWithDelayLoad ( tsconfigFile ) ;
2645
+ project = this . lazyConfiguredProjectsFromExternalProject ?
2646
+ this . createConfiguredProjectWithDelayLoad ( tsconfigFile ) :
2647
+ this . createLoadAndUpdateConfiguredProject ( tsconfigFile ) ;
2637
2648
}
2638
2649
if ( project && ! contains ( exisingConfigFiles , tsconfigFile ) ) {
2639
2650
// keep project alive even if no documents are opened - its lifetime is bound to the lifetime of containing external project
0 commit comments