BT

Language Server Protocol Support for Visual Studio

| by Jonathan Allen Follow 551 Followers on Dec 13, 2017. Estimated reading time: 1 minute |

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 Stage
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.

Tell us what you think

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

Email me replies to any of my messages in this thread
Community comments

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT