Skip to content

Commit e47a2a3

Browse files
authored
Merge pull request #2055 from ahoppen/schedule-indexing-lower-precedence
Don’t show “Scheduling tasks” indexing status when we are currently performing indexing
2 parents bdd6ab1 + f6623d9 commit e47a2a3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Sources/SemanticIndex/SemanticIndexManager.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,6 @@ package final actor SemanticIndexManager {
225225
if inProgressPreparationTasks.values.contains(where: { $0.purpose == .forEditorFunctionality }) {
226226
return .preparingFileForEditorFunctionality
227227
}
228-
if !scheduleIndexingTasks.isEmpty {
229-
return .schedulingIndexing
230-
}
231228
let preparationTasks = inProgressPreparationTasks.mapValues { inProgressTask in
232229
return inProgressTask.task.isExecuting ? IndexTaskStatus.executing : IndexTaskStatus.scheduled
233230
}
@@ -239,10 +236,16 @@ package final actor SemanticIndexManager {
239236
return updateIndexStoreTask.isExecuting ? IndexTaskStatus.executing : IndexTaskStatus.scheduled
240237
}
241238
}
242-
if preparationTasks.isEmpty && indexTasks.isEmpty {
243-
return .upToDate
239+
if !preparationTasks.isEmpty || !indexTasks.isEmpty {
240+
return .indexing(preparationTasks: preparationTasks, indexTasks: indexTasks)
241+
}
242+
// Only report the `schedulingIndexing` status when we don't have any in-progress indexing tasks. This way we avoid
243+
// flickering between indexing progress and `Scheduling indexing` if we trigger an index schedule task while
244+
// indexing is already in progress
245+
if !scheduleIndexingTasks.isEmpty {
246+
return .schedulingIndexing
244247
}
245-
return .indexing(preparationTasks: preparationTasks, indexTasks: indexTasks)
248+
return .upToDate
246249
}
247250

248251
package init(

0 commit comments

Comments
 (0)