Skip to content

Commit c4e6e85

Browse files
committed
Show “Preparing targets” as index status if we only have preparation tasks and no index tasks
I was wondering for a while why we were showing “Indexing 0 / 0” as the index progress. I think it’s if we only have a preparation task but no index tasks running. I’m not entirely sure how this happens because preparation should only happen for two reasons: - We are preparing a target so we can index a files -> We should have an active index task - We are preparing a file for editor functionality of the current file -> we should have a `inProgressPrepareForEditorTask` Maybe I’ll understand it once we have this change in. It seems like a worthwhile change in any way.
1 parent 0e0594b commit c4e6e85

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SourceKitLSP/IndexProgressManager.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ actor IndexProgressManager {
9898
// `indexTasksWereScheduled` calls yet but the semantic index managers already track them in their in-progress tasks.
9999
// Clip the finished tasks to 0 because showing a negative number there looks stupid.
100100
let finishedTasks = max(queuedIndexTasks - indexTasks.count, 0)
101-
message = "\(finishedTasks) / \(queuedIndexTasks)"
101+
if indexTasks.isEmpty {
102+
message = "Preparing targets"
103+
} else {
104+
message = "\(finishedTasks) / \(queuedIndexTasks)"
105+
}
102106
if await sourceKitLSPServer.options.experimentalFeatures.contains(.showActivePreparationTasksInProgress) {
103107
var inProgressTasks: [String] = []
104108
inProgressTasks += preparationTasks.filter { $0.value == .executing }

0 commit comments

Comments
 (0)