BT

InfoQ Homepage News Language Server Protocol Support for Visual Studio

Language Server Protocol Support for Visual Studio

Bookmarks

A corner stone of Visual Studio Code is an open standard known as the Language Server Protocol (LSP). A language server is essentially a compiler/analyzer that runs in a separate process. It handles a variety of tasks including compiler error reporting, hover text, code completion (i.e. IntelliSense), etc.

The concept of a language server isn’t new; editors such as Vim and Emacs have long used them for code completion support. The first major C# implementation of the concept is known as OmniSharp. This language server supports VS Code, Sublime, Atom, Emacs, Vim, and Brackets.

Another VS Code language server was created for TypeScript. Unlike OmniSharp, which uses HTTP, the TypeScript language server “communicates through stdin/stdout with the server process and uses a JSON payload inspired by the V8 debugger protocol for requests and responses”.

With two language servers integrated with VS Code, Microsoft felt it necessary to develop a common standard to be shared by them and future languages. This led to the creation of the Language Server Protocol.

JSON-RPC is used by Language Server Protocol as the basic message format. Briefly, JSON-RPC is a lightweight alternative to SOAP. Like SOAP, it doesn’t mandate a transport layer and thus can work equally well over stdio, named pipes, sockets, etc.

Visual Studio itself does not natively support the Language Server Protocol. For that you need an adapter that allows the VS language services to communicate with an LSP client. Microsoft DevLabs is providing just such a client named simply Language Server Protocol Client.

You will also need a language specific extension. The Language Server Protocol Sample github repository demonstrates how one may be created.

For a more complex example, you can look at Adam Driscoll’s Visual Studio Language Server Protocol extension for PowerShell. Regarding its capabilities, Driscoll writes:

I believe that the future of language support comes from LSP clients. A unified language service shared between Visual Studio and Visual Studio Code will have great results on both tools. We still have a ways to go. The LSP doesn’t support debugging. It’s a different protocol. The LSP itself isn’t even complete within Visual Studio. There’s a chart in the documentation about it. I anticipate it will take some time before this is completely available in VS.

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.