From d1981debec16075189831dc6bf28cb07a4296edd Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Sun, 14 Sep 2025 16:35:10 +0200 Subject: [PATCH] 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. --- Sources/SKTestSupport/SkipUnless.swift | 2 +- .../UpdateIndexStoreTaskDescription.swift | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Sources/SKTestSupport/SkipUnless.swift b/Sources/SKTestSupport/SkipUnless.swift index beeb3900..5b9b4dd4 100644 --- a/Sources/SKTestSupport/SkipUnless.swift +++ b/Sources/SKTestSupport/SkipUnless.swift @@ -476,7 +476,7 @@ package actor SkipUnless { file: StaticString = #filePath, line: UInt = #line ) async throws { - return try await shared.skipUnlessSupportedByToolchain(swiftVersion: SwiftVersion(6, 2), file: file, line: line) { + return try await shared.skipUnlessSupportedByToolchain(swiftVersion: SwiftVersion(6, 3), file: file, line: line) { return await ToolchainRegistry.forTesting.default?.canIndexMultipleSwiftFilesInSingleInvocation ?? false } } diff --git a/Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift b/Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift index 5660c472..61dce87d 100644 --- a/Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift +++ b/Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift @@ -242,15 +242,7 @@ package struct UpdateIndexStoreTaskDescription: IndexTaskDescription { // Disjoint sets of files can be indexed concurrently. return nil } - if self.filesToIndex.count < other.filesToIndex.count { - // If there is an index operation with more files already running, suspend it. - // The most common use case for this is if we schedule an entire target to be indexed in the background and then - // need a single file indexed for use interaction. We should suspend the target-wide indexing and just index - // the current file to get index data for it ASAP. - return .cancelAndRescheduleDependency(other) - } else { - return .waitAndElevatePriorityOfDependency(other) - } + return .waitAndElevatePriorityOfDependency(other) } }