@@ -628,6 +628,7 @@ export interface ProjectServiceOptions {
628
628
globalPlugins ?: readonly string [ ] ;
629
629
pluginProbeLocations ?: readonly string [ ] ;
630
630
allowLocalPluginLoads ?: boolean ;
631
+ skipCleanup ?: boolean ;
631
632
typesMapLocation ?: string ;
632
633
serverMode ?: LanguageServiceMode ;
633
634
session : Session < unknown > | undefined ;
@@ -1292,6 +1293,7 @@ export class ProjectService {
1292
1293
public readonly typingsInstaller : ITypingsInstaller ;
1293
1294
private readonly globalCacheLocationDirectoryPath : Path | undefined ;
1294
1295
public readonly throttleWaitMilliseconds ?: number ;
1296
+ private readonly skipCleanup : boolean | undefined ;
1295
1297
/** @internal */
1296
1298
readonly eventHandler ?: ProjectServiceEventHandler ;
1297
1299
private readonly suppressDiagnosticEvents ?: boolean ;
@@ -1343,6 +1345,7 @@ export class ProjectService {
1343
1345
this . typingsInstaller = opts . typingsInstaller || nullTypingsInstaller ;
1344
1346
this . throttleWaitMilliseconds = opts . throttleWaitMilliseconds ;
1345
1347
this . eventHandler = opts . eventHandler ;
1348
+ this . skipCleanup = opts . skipCleanup ;
1346
1349
this . suppressDiagnosticEvents = opts . suppressDiagnosticEvents ;
1347
1350
this . globalPlugins = opts . globalPlugins || emptyArray ;
1348
1351
this . pluginProbeLocations = opts . pluginProbeLocations || emptyArray ;
@@ -4410,6 +4413,12 @@ export class ProjectService {
4410
4413
openFilesWithRetainedConfiguredProject : Set < Path > | undefined ,
4411
4414
externalProjectsRetainingConfiguredProjects : Set < string > | undefined ,
4412
4415
) {
4416
+ // "Single-run" runs such as command-line linting don't need to prune,
4417
+ // as everything will be discarded quickly anyway.
4418
+ if ( this . skipCleanup ) {
4419
+ return ;
4420
+ }
4421
+
4413
4422
// This was postponed from closeOpenFile to after opening next file,
4414
4423
// so that we can reuse the project if we need to right away
4415
4424
// Remove all the non marked projects
0 commit comments