Skip to content

Commit d1981de

Browse files
committed
Do not cancel update index store tasks in favor of a task with fewer files
We should not take the number of files in an `UpdateIndexStoreTaskDescription` as an indication on how important the task is. If we do need this functionality, eg. because we want to update the index of files with syntactic matches for a rename term, this should be communicated using a specific purpose similar to `TargetPreparationPurpose`. Since the only reason we update the index store for a file right now is background indexing, such a check is not needed.
1 parent a005021 commit d1981de

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

Sources/SKTestSupport/SkipUnless.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ package actor SkipUnless {
476476
file: StaticString = #filePath,
477477
line: UInt = #line
478478
) async throws {
479-
return try await shared.skipUnlessSupportedByToolchain(swiftVersion: SwiftVersion(6, 2), file: file, line: line) {
479+
return try await shared.skipUnlessSupportedByToolchain(swiftVersion: SwiftVersion(6, 3), file: file, line: line) {
480480
return await ToolchainRegistry.forTesting.default?.canIndexMultipleSwiftFilesInSingleInvocation ?? false
481481
}
482482
}

Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,7 @@ package struct UpdateIndexStoreTaskDescription: IndexTaskDescription {
242242
// Disjoint sets of files can be indexed concurrently.
243243
return nil
244244
}
245-
if self.filesToIndex.count < other.filesToIndex.count {
246-
// If there is an index operation with more files already running, suspend it.
247-
// The most common use case for this is if we schedule an entire target to be indexed in the background and then
248-
// need a single file indexed for use interaction. We should suspend the target-wide indexing and just index
249-
// the current file to get index data for it ASAP.
250-
return .cancelAndRescheduleDependency(other)
251-
} else {
252-
return .waitAndElevatePriorityOfDependency(other)
253-
}
245+
return .waitAndElevatePriorityOfDependency(other)
254246
}
255247
}
256248

0 commit comments

Comments
 (0)