At Apple we are making it a priority to support high-quality tooling for all Swift developers, including those working on non-Apple platforms. We want to collaborate with the open-source community and focus our efforts on building common infrastructure that can be shared by Xcode and other editors and platforms.
To that end, I'm excited to announce that we are going to start a new open-source project for a Swift and C-family language service based on the Language Server Protocol. We've chosen to adopt LSP so we can benefit from its active community and wide adoption across other editors and platforms. This means that Visual Studio Code, Atom, Sublime Text, or whatever your favorite editor happens to be, can use the same service as Xcode, and any improvements we make to the service will benefit them all.
This new LSP-based language service will support:
- Semantic functionality for Swift source files (code-completion, highlighting, etc.).
- Semantic functionality for C/C++/ObjC files.
- Cross-language indexing functionality, including but not limited to:
- Cross-language refactoring functionality, like global rename.
We are also going to make the necessary changes for Xcode to use this new LSP-based language service. Similar to how you can load an OSS toolchain in Xcode to try it out now, in the future you will be able to load a build of the OSS LSP service in your installed Xcode and test any fixes or enhancements you make.
We will try to stick to the common set of LSP requests, but for functionality in Xcode that is not currently supported by LSP, we will add extensions to the protocol. If these extensions can be generally useful for other editors as well, we will propose adding them to the LSP specification.
Given that we want to offer first-class support for other editors and platforms, we will aim for the new LSP service to have great support for SwiftPM projects. We will also be open to contributions for supporting other systems as well, like Bazel.
We should have a project repository up within a month, and in the meantime I'd be happy to hear any feedback or questions you may have!