mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user