VS Code Dev Intros Open Source Markdown Language Server — Visual Studio Magazine



VS Code Dev Intros Markdown Open Source Language Server

A member of Microsoft’s Visual Studio Code development team this week presented the culmination of a six-month project: a Markdown language server.

matt biernera JavaScript/TypeScript maintainer for the VS Code team, completely changed the way Markdown works in the editor, replacing (and adding) functionality that was previously built into the editor and augmented by Markdown extensions.

Markdown, to review, is a lightweight markup language for creating formatted text using a plain text editor. Markdown files with a .md file extension are commonly used in GitHub to provide project descriptions in README.md files.

His original idea was to provide Markdown functionality through a language server that he had to build from scratch. Such language servers – following the language server protocol – are commonly used in code editors/IDEs to provide language-specific “intelligences” such as auto-completion, go to definition, hover documentation , error checking (diagnostics), finding any references and much more.

Language server vs no language server
[Click on image for larger view.] Language server vs no language server (source: Microsoft).

To this end, he created the Markdown Language Service – a TypeScript library that provides tools for working with Markdown – and the Markdown Language Server, built using this Markdown Language Service.

Using a language server in debugging
[Click on image for larger view.] Using a language server in debugging (source: Microsoft).

This approach brings multiple benefits. For one, the Markdown tools run as a separate executable, so using Markdown won’t block other extensions that previously had to compete for processing time because they used all the normal extension APIs. Although measured in milliseconds, these delays can be annoying.

More importantly, Markdown functionality becomes portable.

“With this language server, we’re making most of VS Code’s built-in Markdown language tools available to other editors and tools – from document outlines, to smart folding, to path completions -“, Bierner said in an August post. 16 blog posts. While portability to other editors is a primary benefit, the project’s GitHub repository warns that the language server is still in development and has not been tested with other clients.

Bierner’s effort required an exhaustive and phased approach over several months, triggered by the frustration of having to manually type and verify clickable links. Starting with the link completion feature, he removed more and more code from the team’s Markdown extension and incorporated it into his favorite project.

Now, the Markdown language feature set includes:

Markdown Preview Github-style extension
[Click on image for larger view.] Markdown Preview Github-style extension (source: Microsoft).

Since joining the VS Code team in 2016 and taking on Markdown support, Bierner has been active in building extensions – at least 20 – including the Markdown Preview Github Styling tool, which has been installed almost 760,000 times (shown in the graph above).

“In many ways, the last six months have seen more progress in VS Code’s Markdown tool than the last six years I’ve worked in the space,” Bierner said. “Today we are shipping many new tools, some of which were not available for Markdown before. Many of these features benefit the most casual Markdown readers and writers, while others will only be appreciated by users. However, despite all of this progress, I know we’ve only just begun to explore what’s possible in Markdown tooling.

“What really excites me about Markdown Language Server is that now the project is bigger than just VS Code. By making our Markdown tool easy to use, I hope we can help move the Markdown tool for everyone. These open source projects are invitations to build the future of Markdown tools together.”

About the Author

David Ramel is an editor and writer for Converge360.


About Author

Comments are closed.