SolaWing / xcode-build-server

a build server protocol implementation for integrate xcode with sourcekit-lsp
MIT License
283 stars 16 forks source link

sourcekit-lsp does not seem to communicate with xcode-build-server #6

Closed hristost closed 2 years ago

hristost commented 2 years ago

I have been able to use xcode-build-server in an iOS project in the past, but now it does not seem to work reliably with my setup anymore -- I was able to get it to work just once, and could not reproduce afterwards.

Looking at the .compile file, I see that the sdk flag is set correctly for each module:

-sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk 

The log for sourcekit-lsp reveals that the debugServer.json file is read succesfully, and that it retrieves the IndexStoreDB paths:

[2021-06-13 21:42:51.070] initialized build server xcode build server
[2021-06-13 21:42:51.072] opened IndexStoreDB at /Users/hs/Library/Caches/xcode-build-server/file:---Users-hs-amaziograph-src-/indexDatabasePath with store path /Users/hs/Library/Caches/xcode-build-server/file:---Users-hs-amaziograph-src-/indexStorePath

However, all subsequent logs show the wrong sdk flag:

[2021-06-13 21:42:54.353] {
  key.request: source.request.editor.open,
  key.name: "/Users/hs/amaziograph/src/Symmetry/Types/symmetryKaleidoscope.swift",
  key.compilerargs: [
    "-sdk",
    "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk",
    "/Users/hs/amaziograph/src/Symmetry/Types/symmetryKaleidoscope.swift"
  ],
  key.sourcetext: "..."
}

What are some good steps to debug this? I believe that textDocument_sourceKitOptions() is never called, as the log from xcode-build-server only shows calls to build/initialize, build/initialized, and textDocument/registerForChanges.

My swift version is

Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
Target: x86_64-apple-darwin20.5.0
SolaWing commented 2 years ago

@hristost I already fix the compatibility issue. you can update to newest master to try it.

hristost commented 2 years ago

Thanks! It works alright now