SwiftLSPClient

It’s common to focus on the server-side of Language Server Protocol implementations. This library is all about the client side.

When I first stumbled across Microsoft’s Language Server Protocol, I was really excited. Chime’s entire reason for being is to offer a polished macOS UI with top-notch language support. LSP seemed like a fantastic way to separate out the language specifics from the editor itself.

However, things didn’t work out as well as I’d hoped once I started looking more closely. First, the protocol itself was missing a few features I felt were important, notably syntax highlighting. Second, at the time, there were no LSP implementations for Go. Finally, Chime already had an internal protocol that was similar in concept to LSP.

But, since then, a lot has changed. For one, there is now a real LSP implementation for Go. And, in a really exciting development, the Go team themselves are working on a first-class LSP server. I think this is where LSP can really shine – the language maintainers themselves building and supporting the tooling for client editors.

So, I started using LSP to back some features, and it has worked out quite well. It’s still not a silver-bullet solution, though. I’ve found there is substantial, per-server-implementation work required by the client to provide a really good experience. But, I’m thrilled by the direction. It’s a very exciting time to be involved in developer tooling.

Particularly so if you are a Swift developer. Apple made some waves by announcing that they have begun migrating their tooling all towards LSP. That’s quite an endorsement. I’m a little surprised, but really interested to see where it leads.

That announcement got us talking. We have a functional, if incomplete, LSP client implementation. And, while our project is closed-source, we’ve really wanted to open source components where we can. So, that’s exactly what we’ve done. You can check out our client library for LSP on github. It’s written in Swift, and ready to be used in your Carthage-based project. And, of course, it works with sourcekit-lsp ;)

Personally, I’m really excited to see if anyone out there finds this library useful. It was fun to work on, and we fully intend to keep maintaining and expanding it. If you find a use for it, please get in touch and let us know. We’d really love to hear about it.

Tue, Dec 11, 2018 - Matt Massicotte

Previous: Hello, world!
Next: Getting a Handle on Operations