Skip to content

Commit 4ad6eb3

Browse files
committed
Ensure that the indexstore-db is up-to-date before deciding which source files we need to re-index
Waiting for the indexstore-db to be updated is cheaper than potentially not knowing about unit files, which causes the corresponding source files to be re-indexed. rdar://128645743
1 parent 3300c77 commit 4ad6eb3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/SemanticIndex/SemanticIndexManager.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ public final actor SemanticIndexManager {
193193
signposter.endInterval("Preparing", state)
194194
}
195195
await orLog("Generating build graph") { try await self.buildSystemManager.generateBuildGraph() }
196+
// Ensure that we have an up-to-date indexstore-db. Waiting for the indexstore-db to be updated is cheaper than
197+
// potentially not knowing about unit files, which causes the corresponding source files to be re-indexed.
198+
index.pollForUnitChangesAndWait()
196199
let index = index.checked(for: .modifiedFiles)
197200
let filesToIndex = await self.buildSystemManager.sourceFiles().lazy.map(\.uri)
198201
.filter { uri in

0 commit comments

Comments
 (0)