Extensibility is one of the key features in Visual Studio Code, because you can add tools, languages, code snippets, debuggers, key bindings, and themes. Especially about languages, Visual Studio Code allows for extending the code editor with specific syntax support, which can also include IntelliSense, code snippets, and code refactoring.
This all means that Visual Studio Code has open support for any language and any tool on any platform, opening to infinite development scenarios. This chapter explains how to find and install extensions and how to manage extensions on your system.
Installing Extensions
An extension’s page provides a detailed description and guidance about using the extension, often providing links to additional documentation, resources, and to the source code (if open source). I strongly recommend you to read the detail page to get information about what the extension includes, especially with extensions that add language support, because it is important to know if there is only support for a new syntax or also for IntelliSense, code snippets, and debugging.
If you click the Install button, the download link will be opened by Visual Studio Code for easy installation. You can also download the offline installer of the extension for later reuse. To do so, click the Download Extension hyperlink under the Resources group, on the right of the page. In this way you will be able to download a .vsix installer file that you can then launch manually.
Note
If you have experience with the Microsoft Visual Studio development environment, you probably know that VSIX is the format used by Microsoft for extension installer files. However, the VSIX format for Visual Studio Code is not the same. Extensions for Visual Studio Code are packaged with a tool called vsce and cannot work with Visual Studio 2017 on Windows and with Visual Studio for Mac.
You can click the Install button when ready. You will need to click the Reload button (that appears once the installation completes) to enable the extension in VS Code. You can also filter the search results; for instance, if you type category:linters in the search box, Visual Studio Code will list all the extensions that provide linting support with syntax colorization to specific languages. You can use the same category names you see in the Visual Studio Marketplace.
As an alternative, you can use the Command Palette to download (and manage) extensions. You can open the Command Palette, type in ext, and a list of self-explanatory commands related to extension management will appear. You will typically prefer working with extensions from the Command Palette when you do not want to lose focus on the active editor window, otherwise using the Extensions bar’s user interface is definitely easier.
Note
Many extensions, especially extensions that provide full language support such as C# and C/C++, rely on additional tools like debuggers and libraries. These additional tools are usually downloaded the first time you use the extension. For example, in the case of the C# extension, required tools and libraries are downloaded the first time you create or open a C# file. Also, newly downloaded extensions might need some initial configuration. In this case, a popup will appear explaining what you need to do to get started.
Extension Recommendations
Visual Studio Code can provide suggestions about recommended extensions based on your activity. When you open the Extensions bar, you will see a group called RECOMMENDED EXTENSIONS , under the list of installed extensions.
You can click Install and Visual Studio Code will automatically install the extension that it thinks to be the most appropriate, or you can click Show Recommendations to see a list of possible extensions. In both cases, the Extensions bar will be opened and you will see the list of available recommended extensions, but when you click Install, the proposed extension will be already installing.
Useful Extensions
Recommended Extensions for Visual Studio Code
Name | Description | Type |
---|---|---|
C# | C# full language support | Language, debugger, editing |
C/C++ | C and C++ full language support | Language, debugger, editing |
Python | Python full language support | Language, debugger, editing |
Language Support for Java | Java full language support | Language, editing |
Microsoft SQL Server | SQL Server support | Language, editing, tools |
Debugger for Chrome | JavaScript debugging with the Chrome browser | Debugger |
Debugger for Java | Java debugging support | Debugger |
Debugger for Edge | JavaScript debugging with the Edge browser | Debugger |
Cordova Tools | Mobile development with Apache Cordova | Editing, tools |
Node Debug | Debug support for Node.js | Debugger |
Visual Studio Keymap | Keyboard shortcuts based on Microsoft Visual Studio | Key binding |
Atom Keymap | Keyboard shortcuts based on Atom | Key binding |
Notepad++ Keymap | Keyboard shortcuts based on Notepad++ | Key binding |
Docker | Language support for Dockerfile | Language, editing, tools |
vscode-icons | Colored icons for the Explorer bar | Tools |
GitLens | Extend Git integrated features for Visual Studio Code | Tools |
PowerShell | PowerShell scripting support | Language, editing, tools |
Visual Studio Team Services | Integrated Git support for the Visual Studio Team Services platform | Tools |
As you work with Visual Studio Code on your projects and on the operating system of your choice, you will be able to find and fine-tune extensions that will help you be more productive.
Managing Extensions
You can also click an extension name, and the detail page will show the Disable and Uninstall buttons. Notice that every time you disable or uninstall an extension, you will need to click a button called Reload (that appears when the extension has been disabled or uninstalled) to refresh the development environment. It is worth mentioning that you can change the default view of the Extensions bar (displaying the list of installed extensions) by clicking the … button at the top of the EXTENSIONS group. When you click this button, a popup menu appears showing different options, such as viewing popular extensions, as well as commands for searching extension updates and installing extensions from .vsix files.
Note
Shortcuts for extension management are also available in the Command Palette.
Configuring Extensions
Normally, extension authors provide detailed comments that explain what an option is about so that it is easier for you to fine-tune an extension behavior, such as in the case of the C# extension.
Hints About Extension Authoring
You can build extensions for Visual Studio Code and share them through the Marketplace. You can basically build any type of supported extension, such as language support, editing features, themes, code snippets, debugger adapters, and key bindings. You will also need to register as a publisher on the Visual Studio Marketplace, which requires you to have a Microsoft account.
Extensions are usually written with TypeScript and, for most of them, you can use an extension generator such as the Yeoman tool on Node.js. As you can imagine, extension authoring is a complex task, and it is out of scope in a book from the Distilled series. If you are interested in extension authoring, you can walk through the official documentation ( https://code.visualstudio.com/docs/extensions/overview ) which provides examples and guidance for many scenarios.
Summary
Extensibility is a key feature in Visual Studio Code, because it allows adding power to the development environment. Extensions can add new languages (with or without rich editing support), debuggers, keyboard shortcuts, themes, code snippets, and tools. You can install extensions from the Visual Studio Marketplace or from within Visual Studio Code, through the Extensions bar or the Command Palette.
Visual Studio Code can also provide extension recommendations based on the context, for example, when you open a file written in a language for which there is no built-in support. Visual Studio Code makes it also simple to manage extensions with shortcuts to disable and uninstall extensions but also with configuring extensions’ behavior via the user settings file. In the next chapter, you will see how to leverage extensions to add features to Visual Studio Code to another core feature that makes it a step forward compared to its competitors: version control with Git.