mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-06-24 12:21:58 +02:00
0a432b94d2
Binary targets backed by remote `.artifactbundleindex` URLs cause SwiftPM to re-extract the artifact bundle into the scratch directory on every package load. The resulting file-change events (delete + create) for the extracted files triggered another reload, causing an infinite loop. Add `isInScratchDirectory` to `fileEventShouldTriggerPackageReload` to filter out events before the build-settings check. It covers both the configured scratch directory and the default `.build/` directory (which receives regular `swift build` output even when a custom scratch path is configured). Also add tests using local zip-based binary targets to cover both the default and custom-scratch-path scenarios. Local zips are used in the tests to avoid a network dependency; they exercise the same `isInScratchDirectory` code path even though the infinite loop in practice requires a remote `.artifactbundleindex` target (where SwiftPM's checksum mismatch causes re-extraction on every load). https://github.com/swiftlang/sourcekit-lsp/issues/2615