Visual Studio IDE Opens Up to More Programming Languages
Visual Studio developers who want to program in non-native languages can now write their own extensions to do so with new support (in preview) for the Language Server Protocol.
The Language Server Protocol (LSP) is an open source project from Microsoft that provides server-based "language smartness" to client tools such as the VS IDE. That smartness includes functionality such as source code auto-completion, Go To Definition, Find All References and so on.
Microsoft summarized the new LSP client tool -- which comes as an extension itself -- thusly:
The Language Server Protocol (LSP) is a common protocol that provides language service features to developer tools. A language server contains the deep understanding of a specific language while the Language Server Protocol provides the communication between the language server and the developer tool. The complex logic of a language server needs to be implemented only once and then from there, smaller pieces of code can be written to allow the language server to talk to the specific developer tool. This allows for a consistent editing experience for any tool that supports the protocol.
One such tool that already supports the protocol is Visual Studio Code, Microsoft's open source, cross-platform code editor. As a popular (more than 1 million downloads) example of what that support enables, Red Hat has authored an LSP-enabled extension to provide Java support in VS Code, aptly titled "Language Support for Java by Red Hat," available in the Visual Studio Code marketplace. The tool uses the Eclipse JDT Language Server implementation of the LSP.
Now, the ability to create the same kinds of extensions for their favorite languages in the full-fledged IDE has excited some developers, as evidenced by a Reddit thread discussing building an extension to provide support for the Rust programming language in Visual Studio.
And there was already widespread excitement for the LSP even before the new client tool was announced, as evidenced by last month's article on the Kichwa Coders ("Eclipse Experts for Embedded Tools Solutions") site titled "The Language Server Protocol Will Revolutionize How You Code."
To get in on the excitement and author their own extensions, developers need to install the Visual Studio extension development workload on Visual Studio 2017 Preview.
"For the preview, you will have to declare a dependency on the Language Protocol Client Preview extension," Microsoft said. "This means that any customers who wish to install your language server extension must also have the Language Server Protocol Client preview extension installed first."
The new LSP extension, provided by Microsoft DevLabs, has been installed 120 times as of this writing, receiving no reviews or ratings yet.
The source code for Microsoft's LSP project is available on GitHub, where the project has garnered 2,142 stars, with 38 contributors.
Also available on GitHub is a Language Server Protocol Sample that provides a mock language server using the LSP and a mock language client extension in Visual Studio.
Further guidance is provided in documentation titled "Adding a Language Server Protocol Extension," along with specific client and protocol API documentation.
Microsoft said it hopes to collect developer feedback on the experimental preview, via comments on the LSP extension page or via e-mail at firstname.lastname@example.org.
David Ramel is the editor of Visual Studio Magazine.