What is Language Server Protocol(LSP)?

  • Language Server Protocol defines standardized protocol with which both a text editor or IDE(client) and a language(server) communicate.
  • The protocol is based on JSONRPC.
  • A client(text editor) can implement
    • Go to definition
    • Error and warnings
    • Auto completion



  • Solves m-times-n complexity problems


What is Sourcekit-LSP?


  • Apple’s LSP implementation on top of sourcekitd and clangd
  • sourcekitd is a framework that provide IDE features
  • clangd for c-family languages (C/C++/ObjC) language server
  • supports only Swift Package Manager project

As of Xcode 11.4, SourceKit-LSP is a built-in tool.


Xcode and the corresponding Command Line Tools package include the SourceKit-LSP language server for Swift and C-based languages. The language server is in early development, and this is a great time to experiment with it. SourceKit-LSP can be used with third-party tools that support the Language Server Protocol (LSP), and it supports Swift Packages built from the command-line. For information about using SourceKit-LSP see Getting Started with SourceKit-LSP. (48004600)


VSCode Integration


$ cd Editors/vscode
$ npm run createDevPackage
$ code --install-extension out/sourcekit-lsp-vscode-dev.vsix
  • VSCode extension isn’t published on marketplace yet.
  • You must build on your own.
  • try alternatives but they need more complex integration


LSP transforms text editor into IDE

Try writing Swift on

  • VSCode(recommended)
  • Sublime Text
  • Vim
  • Emacs