Should SourceKit-LSP from Xcode 12 Beta work with Swift 5.3?

Hello, I'm the author and maintainer of the one of the SourceKit-LSP clients out there. I recently got a report about some incorrect behavior of SourceKit-LSP from Xcode 12 Beta and a Swift 5.3 project. Basically, the steps to reproduce are:

  • Create a basic Swift 5.3 SPM project with Xcode.
  • Configure the client to point to SourceKit-LSP from the Xcode 12 Beta toolchain.

With that configuration, Swift modules are not compiled correctly by SourceKit-LSP and there's a lot of code completion problems, including incorrect diagnostics.

Debugging further, the server returns this message to the client:

[Trace - 11:29:57 PM] Received notification 'window/logMessage'.
Params: {
"message": "package at '/Users/dmartin/Desktop/FooBar' is using Swift tools version 5.3.0 but the installed version is 5.2.0",
"type": 4
}

Workarounds that work:

  • Use a Swift 5.2 package.
  • Use SourceKit-LSP from a recent 5.3 snapshot from Swift.org

Is it expected that SourceKit-LSP from Xcode 12 Beta does not work correctly with Swift 5.3 projects?

Thanks.

1 Like

I can't answer the specific question, but it should be expected that the Swift 5.3 shipped by Xcode 12 is lagging behind the latest 5.3 snapshots, but will catch up at some point.

Is it expected that SourceKit-LSP from Xcode 12 Beta does not work correctly with Swift 5.3 projects?

No, this is definitely a bug. Thanks for reporting, I am able to reproduce this. If you would like to be notified when this is fixed, please file a bug via http://feedbackassistant.apple.com, since this is specific to the version of sourcekit-lsp in Xcode.

1 Like

Thanks for confirming! I've created FB7961416 to track this bug.

1 Like
Terms of Service

Privacy Policy

Cookie Policy