Swift version
No response
Platform
No response
Editor
VSCode/Cursor
Description
SourceKit-LSP should pass --force-resolved-versions when invoking SwiftPM for background indexing. This ensures:
- SourceKit-LSP never writes to
Package.resolved.
- Indexing operates against the package state already on disk, which is the correct behavior — indexing should be read-only.
- If packages are out of date, the resolution will fail, which is preferable to silently corrupting the resolved file.
This aligns with the principle that background indexing should be a read-only operation with respect to project state.
Steps to Reproduce
- Configure a Swift package project that requires
--replace-scm-with-registry for correct dependency resolution.
- Set the flag in
.vscode/settings.json:
"swift.packageArguments": ["--replace-scm-with-registry"]
- Resolve dependencies normally —
Package.resolved is correct.
- Wait for SourceKit-LSP background indexing to trigger a package resolution.
- Observe that
Package.resolved is overwritten with dependencies resolved without the --replace-scm-with-registry flag.
Logging
No response
Swift version
No response
Platform
No response
Editor
VSCode/Cursor
Description
SourceKit-LSP should pass
--force-resolved-versionswhen invoking SwiftPM for background indexing. This ensures:Package.resolved.This aligns with the principle that background indexing should be a read-only operation with respect to project state.
Steps to Reproduce
--replace-scm-with-registryfor correct dependency resolution..vscode/settings.json:Package.resolvedis correct.Package.resolvedis overwritten with dependencies resolved without the--replace-scm-with-registryflag.Logging
No response