Skip to content

Resolve swiftly when referenced in compile commands #2146

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

Closed
wants to merge 1 commit into from

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 12, 2025

  • Explanation: When the compiler in compile_commands.json references a swift executable that’s a symlink to swiftly, SourceKit-LSP got confused because the swift executable doesn’t reside in a real toolchain, causing us to not provide any semantic functionality. When we discover that the swift executable reference in compile commands references a swiftly executable, use swiftly use -p to resolve the binary in the real toolchain and continue operating based on that.
  • Scope: compile_commands.json projects that reference a swift executable that’s managed by swiftly
  • Issue: LSP stops working in editors (VSCode, Sublime Text, Zed) with swiftly toolchains, logs say "No language service for ..." #2128 / rdar://150301344
  • Original PR: Resolve swiftly when referenced in compile commands #2143
  • Risk: This should not impact projects that don’t reference swift executables managed by swiftly and if you used a compile_commands project with an executable managed by swiftly, behavior was completely broken, so there should be no risk of introducing new issues.
  • Testing: Added regression test
  • Reviewer: @bnbarham @hamishknight

When the compiler in `compile_commands.json` references a `swift` executable that’s a symlink to `swiftly`, SourceKit-LSP got confused because the `swift` executable doesn’t reside in a real toolchain, causing us to not provide any semantic functionality.

When we discover that the `swift` executable reference in compile commands references a `swiftly` executable, use `swiftly use -p` to resolve the binary in the real toolchain and continue operating based on that.

Fixes swiftlang#2128
rdar://150301344
@ahoppen ahoppen requested a review from a team as a code owner May 12, 2025 13:21
@ahoppen
Copy link
Member Author

ahoppen commented May 12, 2025

@swift-ci Please test

@bnbarham
Copy link
Contributor

Opened a merge #2149

@ahoppen ahoppen closed this May 13, 2025
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 this pull request may close these issues.

2 participants