@@ -711,35 +711,28 @@ package final actor SemanticIndexManager {
711711 // sort files to get deterministic indexing order
712712 . sorted ( by: { $0. file. sourceFile. stringValue < $1. file. sourceFile. stringValue } )
713713
714- var alreadyScheduledTasks : Set < FileToIndex > = [ ]
715- for file in filesToIndex {
716- let inProgress = inProgressIndexTasks [ file. file ]
717-
718- let shouldScheduleIndexing : Bool
719- switch inProgress? . state {
720- case nil :
721- shouldScheduleIndexing = true
722- case . creatingIndexTask, . waitingForPreparation:
723- // We already have a task that indexes the file but hasn't started preparation yet. Indexing the file again
724- // won't produce any new results.
725- alreadyScheduledTasks . insert ( file . file )
726- shouldScheduleIndexing = false
727- case . preparing ( _ , _ ) , . updatingIndexStore ( _ , _ ) :
728- // We have started indexing of the file and are now requesting to index it again. Unless we know that the file
729- // hasn't been modified since the last request for indexing, we need to schedule it to get re-indexed again.
730- if let modDate = file . fileModificationDate , inProgress ? . fileModificationDate == modDate {
731- shouldScheduleIndexing = false
732- } else {
733- shouldScheduleIndexing = true
714+ filesToIndex =
715+ filesToIndex
716+ . filter { file in
717+ let inProgress = inProgressIndexTasks [ file . file ]
718+
719+ switch inProgress? . state {
720+ case nil :
721+ return true
722+ case . creatingIndexTask, . waitingForPreparation:
723+ // We already have a task that indexes the file but hasn't started preparation yet. Indexing the file again
724+ // won't produce any new results.
725+ return false
726+ case . preparing ( _ , _ ) , . updatingIndexStore ( _ , _ ) :
727+ // We have started indexing of the file and are now requesting to index it again. Unless we know that the file
728+ // hasn't been modified since the last request for indexing, we need to schedule it to get re-indexed again.
729+ if let modDate = file . fileModificationDate , inProgress ? . fileModificationDate == modDate {
730+ return false
731+ } else {
732+ return true
733+ }
734734 }
735735 }
736- if shouldScheduleIndexing {
737-
738- } else {
739- alreadyScheduledTasks. insert ( file. file)
740- }
741- }
742- filesToIndex = filesToIndex. filter { !alreadyScheduledTasks. contains ( $0. file) }
743736
744737 if filesToIndex. isEmpty {
745738 // Early exit if there are no files to index.
0 commit comments