Skip to content

Commit e28c460

Browse files
authored
Merge pull request #2079 from ahoppen/dependent-targets
Move `targets(dependingOn:)` call out of the changed files loop
2 parents 54ac721 + 2ddacb1 commit e28c460

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/SemanticIndex/SemanticIndexManager.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,19 +382,19 @@ package final actor SemanticIndexManager {
382382
let changedFiles = events.filter { $0.type != .deleted }.map(\.uri)
383383
await indexStoreUpToDateTracker.markOutOfDate(changedFiles)
384384

385-
// Preparation tracking should be per file. For now consider any non-known-language change as having to re-prepare
386-
// the target itself so that we re-prepare potential input files to plugins.
387-
// https://github.com/swiftlang/sourcekit-lsp/issues/1975
388385
var outOfDateTargets = Set<BuildTargetIdentifier>()
386+
var targetsOfChangedFiles = Set<BuildTargetIdentifier>()
389387
for file in changedFiles {
390388
let changedTargets = await buildSystemManager.targets(for: file)
389+
targetsOfChangedFiles.formUnion(changedTargets)
391390
if Language(inferredFromFileExtension: file) == nil {
391+
// Preparation tracking should be per file. For now consider any non-known-language change as having to
392+
// re-prepare the target itself so that we re-prepare potential input files to plugins.
393+
// https://github.com/swiftlang/sourcekit-lsp/issues/1975
392394
outOfDateTargets.formUnion(changedTargets)
393395
}
394-
395-
let dependentTargets = await buildSystemManager.targets(dependingOn: changedTargets)
396-
outOfDateTargets.formUnion(dependentTargets)
397396
}
397+
outOfDateTargets.formUnion(await buildSystemManager.targets(dependingOn: targetsOfChangedFiles))
398398
if !outOfDateTargets.isEmpty {
399399
logger.info(
400400
"""

0 commit comments

Comments
 (0)