BT

InfoQ Homepage News Swift Adopts the Language Server Protocol

Swift Adopts the Language Server Protocol

This item in japanese

Bookmarks

Apple's Swift team announced they are going to provide support for using Swift with the Language Server Protocol (LSP). This will open up the possibility for developers to use Swift in any editor that supports LSP with code-completion, syntax-highlighting, etc.

In addition to code completion and syntax highlighting, the Swift LSP-compliant language service will support cross language-indexing across C/C++/ObjC sources to power jump-to-definition, call-hierarchy, search-symbols, and refactoring. Apple’s team plans to bring Xcode to the new language service and extend the protocol to support Xcode editing features that are not included in LSP.

According to current plans, the Swift LSP service will use SourceKit and integrate it with Clangd, an open-source implementation of the Language Server Protocol based on Clang. The Language Server Protocol implementation for Swift is available on GitHub. Still, it is considered yet in early development and most more advanced features are not yet available.

Among the benefits of Swift LSP service, it will improve Swift usability on Linux, thus possibly improving the language adoption beyond the Apple’s ecosystem. Additionally, as a side effect of bringing LSP to Xcode, Xcode could include support for additional languages, such as C#, Rust, and many others, including a few that theoretically Xcode already supports, including XML, JSON, etc. Making Xcode LSP-compliant is not currently in the team’s focus, though.

The Language Server Protocol was originally developed at Microsoft as the protocol Visual Studio Code used to communicate with its language services. Microsoft open-sourced LSP in 2016. The big advantage LSP brings is the reusability of language services across LSP-compliant editors. This reduce significantly the effort required for a language team to make their language fully supported in a variety of editors, since they only need to implement an LSP-compliant language server that will be usable from any LSP-compliant editor.

Currently, there are over 70 LSP-compliant language servers, and many of the major programming tools support LSP, including Eclipse, emacs, GNOME Builder, Atom, vim, Visual Studio, and Visual Studio Code.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.