Xcode project support?

Is it planned/wanted to have support for Xcode projects in SourceKit-LSP, alongside SPM? I don't know if there's any strategic/technical reason to not offer that, or it is simply that nobody has worked on this yet. I think it would greatly help with the adoption of SourceKit-LSP, as most of the people that have contacted me about the project want to use it with an existing Xcode project.

One problem is that the Xcode build system has traditionally been very hermetic and there's not a clear and documented way to extract compilation flags.


This is likely something Apple won’t comment on, given Xcode is an Apple product. Hopefully we’ll see something at WWDC. Personally I’m not holding my breath. Xcode support for LSP by this summer would be blisteringly fast for them.

I should say that when the official Swift LSP implementation support was announced, they state there would be eventual Xcode support. When that will ship and what it will look like are still up in the air. I would hope it means we'd get better integration with SPM, but I wouldn't count on it. Xcode already uses as least some parts of SPM's llbuild under the hood (IIUC), but who knows how much of a leap it would be from that build system to supporting SPM's. It's extremely irritating not knowing where the tools you use every day are going and not being able to fix the issues you find, but that's Apple.

Hey Daniel, I've replied to a similar question previously here.

Oh, thanks, I missed that conversation. Makes sense, we'll have to wait for the Xcode build system to export the compile flags somehow. There's already options, like some existing tools that parse the xcodebuild.log to do that, but those tools always seemed clunky to me.

FWIW if you're interested in parsing the build logs for this, and you're using the new build system, parsing the structured llbuild definition is much easier. You can find the definition of the format here and an example we wrote for parsing the command line arguments for each file here

1 Like

SourceKit-LSP supported BSP as a external build extension. And I extract compiler info from xcode build logs By GitHub - SolaWing/xcode-build-server: a build server protocol implementation for integrate xcode with sourcekit-lsp . This basicly works. except the index not accurate or update.