Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourceKit-LSP overwriting results of swift package update #707

Closed
adam-fowler opened this issue Feb 8, 2023 · 1 comment · Fixed by #762
Closed

SourceKit-LSP overwriting results of swift package update #707

adam-fowler opened this issue Feb 8, 2023 · 1 comment · Fixed by #762

Comments

@adam-fowler
Copy link
Contributor

If I run a swift package update on a project that has SourceKit-LSP running on it. The results of the update are overwritten by SourceKit-LSP.

If I have a dependency on a package from: 1.0.0 and I currently have version 1.0.1 but a 1.0.2 has been released when I run swift package update I would expect it to update to using version 1.0.2. It appears when SourceKit-LSP is running the version updates to 1.0.2 and then is reverted back to 1.0.1.

This is with swift 5.7 and running inside VSCode.

@ahoppen
Copy link
Collaborator

ahoppen commented Feb 8, 2023

rdar://105173375

ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Jul 7, 2023
`SwiftPMWorkspace.reloadPackage` called `loadPackageGraph`, which causes package resolution and could thus update `Package.resolved`. This caused race conditions when `swift package update` was run from terminal while sourcekit-lsp is running since sourcekit-lsp was notified about the file changes and thus reloaded the pacakge to get build settings for the modified files.

Set `forceResolvedVersions` to only resolve packages based on the versions in `Package.resolved`, eliminating this problem.

Fixes apple#707
rdar://105173375
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Jul 7, 2023
`SwiftPMWorkspace.reloadPackage` called `loadPackageGraph`, which causes package resolution and could thus update `Package.resolved`. This caused race conditions when `swift package update` was run from terminal while sourcekit-lsp is running since sourcekit-lsp was notified about the file changes and thus reloaded the pacakge to get build settings for the modified files.

Set `forceResolvedVersions` to only resolve packages based on the versions in `Package.resolved`, eliminating this problem.

Fixes apple#707
rdar://105173375
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Jul 7, 2023
`SwiftPMWorkspace.reloadPackage` called `loadPackageGraph`, which causes package resolution and could thus update `Package.resolved`. This caused race conditions when `swift package update` was run from terminal while sourcekit-lsp is running since sourcekit-lsp was notified about the file changes and thus reloaded the pacakge to get build settings for the modified files.

Set `forceResolvedVersions` to only resolve packages based on the versions in `Package.resolved`, eliminating this problem.

Fixes apple#707
rdar://105173375
@ahoppen ahoppen closed this as completed Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants