@@ -505,6 +505,52 @@ export class AnalyzerService {
505
505
this . _backgroundAnalysisProgram . restart ( ) ;
506
506
}
507
507
508
+ // Attempts to make progress on source file enumeration if there is an active
509
+ // source enumerator associated with the service. Returns true if complete.
510
+ enumerateSourceFiles ( maxSourceEnumeratorTime : number ) : boolean {
511
+ // If there is no active source enumerator, we're done.
512
+ if ( ! this . _sourceEnumerator ) {
513
+ return true ;
514
+ }
515
+
516
+ let fileMap : Map < string , Uri > ;
517
+
518
+ if ( this . _executionRootUri . isEmpty ( ) ) {
519
+ // No user files for default workspace.
520
+ fileMap = new Map < string , Uri > ( ) ;
521
+ } else {
522
+ const enumerator = this . _sourceEnumerator ;
523
+ const enumResults = timingStats . findFilesTime . timeOperation ( ( ) =>
524
+ enumerator . enumerate ( maxSourceEnumeratorTime )
525
+ ) ;
526
+
527
+ if ( ! enumResults . isComplete ) {
528
+ return false ;
529
+ }
530
+
531
+ // Update the config options to include the auto-excluded directories.
532
+ const excludes = this . options . configOptions ?. exclude ;
533
+ if ( enumResults . autoExcludedDirs && excludes ) {
534
+ enumResults . autoExcludedDirs . forEach ( ( excludedDir ) => {
535
+ if ( ! FileSpec . isInPath ( excludedDir , excludes ) ) {
536
+ excludes . push ( getFileSpec ( this . _configOptions . projectRoot , `${ excludedDir } /**` ) ) ;
537
+ }
538
+ } ) ;
539
+ this . _backgroundAnalysisProgram . setConfigOptions ( this . _configOptions ) ;
540
+ }
541
+
542
+ fileMap = enumResults . matches ;
543
+
544
+ const fileList = this . _getTrackedFileList ( fileMap ) ;
545
+ this . _backgroundAnalysisProgram . setTrackedFiles ( fileList ) ;
546
+
547
+ // Source file enumeration is complete. Proceed with analysis.
548
+ this . _sourceEnumerator = undefined ;
549
+ }
550
+
551
+ return true ;
552
+ }
553
+
508
554
protected runAnalysis ( token : CancellationToken ) {
509
555
// In pull diagnostics mode, the service doesn't perform analysis on its own.
510
556
// Instead the client deliberately asks for diagnostics on a file-by-file basis.
@@ -574,52 +620,6 @@ export class AnalyzerService {
574
620
} , timeUntilNextAnalysisInMs ) ;
575
621
}
576
622
577
- // Attempts to make progress on source file enumeration if there is an active
578
- // source enumerator associated with the service. Returns true if complete.
579
- protected enumerateSourceFiles ( maxSourceEnumeratorTime : number ) : boolean {
580
- // If there is no active source enumerator, we're done.
581
- if ( ! this . _sourceEnumerator ) {
582
- return true ;
583
- }
584
-
585
- let fileMap : Map < string , Uri > ;
586
-
587
- if ( this . _executionRootUri . isEmpty ( ) ) {
588
- // No user files for default workspace.
589
- fileMap = new Map < string , Uri > ( ) ;
590
- } else {
591
- const enumerator = this . _sourceEnumerator ;
592
- const enumResults = timingStats . findFilesTime . timeOperation ( ( ) =>
593
- enumerator . enumerate ( maxSourceEnumeratorTime )
594
- ) ;
595
-
596
- if ( ! enumResults . isComplete ) {
597
- return false ;
598
- }
599
-
600
- // Update the config options to include the auto-excluded directories.
601
- const excludes = this . options . configOptions ?. exclude ;
602
- if ( enumResults . autoExcludedDirs && excludes ) {
603
- enumResults . autoExcludedDirs . forEach ( ( excludedDir ) => {
604
- if ( ! FileSpec . isInPath ( excludedDir , excludes ) ) {
605
- excludes . push ( getFileSpec ( this . _configOptions . projectRoot , `${ excludedDir } /**` ) ) ;
606
- }
607
- } ) ;
608
- this . _backgroundAnalysisProgram . setConfigOptions ( this . _configOptions ) ;
609
- }
610
-
611
- fileMap = enumResults . matches ;
612
-
613
- const fileList = this . _getTrackedFileList ( fileMap ) ;
614
- this . _backgroundAnalysisProgram . setTrackedFiles ( fileList ) ;
615
-
616
- // Source file enumeration is complete. Proceed with analysis.
617
- this . _sourceEnumerator = undefined ;
618
- }
619
-
620
- return true ;
621
- }
622
-
623
623
protected applyConfigOptions ( host : Host ) {
624
624
// Indicate that we are about to reanalyze because of this config change.
625
625
if ( this . options . onInvalidated ) {
0 commit comments