Extending Visual Studio Code

Microsoft makes it easy to add new tools and language support to its open source development tool

Developers like good code editors, and it’s not surprising that Visual Studio Code (aka VS Code) has become so popular so quickly. Go to any developer event and you’ll see Visual Studio Code up on the big screen, being used for live coding demos. With versions for MacOS, Linux, and Windows, it’s not surprising it’s had such a good response. You can pick it up on any developer PC and get started, knowing that you’re using the same tool with the same shortcuts and, most importantly, many of the same extensions.

The extension model is one of Visual Studio Code’s key features. There’s a huge library of extensions, adding language support, integrating with cloud services, or providing snippets of code to make your life easier. Microsoft’s VS Code Extensions API gives you access to various application endpoints, which can be accessed with your packaged JavaScript or TypeScript code, with data stored as JSON. Some features don’t even need code; they can be added using declarative methods. If you want to start building your own extensions, there’s plenty of sample code on GitHub to help you get started and a marketplace where you can share with other developers.

Inside VS Code’s extension model

Extensions are intended to target specific editor functions. One of the more popular options offers new themes to change the look and feel of the editing environment. Themes can change the way source code is displayed or the UI itself, theming both color and icons. Similarly Language Extensions use declarative techniques to support syntax highlighting, using the open TextMate grammar model. (If you’ve got a language grammar written for another editor that uses the same approach, it’s easy to bring it to VS Code.) VS Code’s language support includes tools for working with code snippets, and a way of defining how languages treat comments, how brackets and line terminations are handled, and how you can hide and display sections of code.

To continue reading this article register now