Lesson 5 / 863%

Lesson 5

Extensions

20 min

Install and manage extensions from the Marketplace to enrich VS Code.

Definition

An extension is a small additional program that you install in VS Code to add a feature to it: support for a language, a visual theme, a formatting tool, typing assistance... Extensions are gathered in the Marketplace, the official store built into the editor, where most of them can be downloaded for free in a few clicks.

What is an extension?

One of VS Code's greatest strengths is its ecosystem ofextensions. An extension is a small additional program, developed by Microsoft or by the community, that you install to add a feature that doesn't exist natively in the editor: support for a new language, an automatic code formatter, a visual theme, an FTP client, an integration with an external tool... There are tens of thousands of them, all available from the Marketplace, most of them for free.

Thanks to this system, VS Code stays lightweight while being able to adapt to almost any need. The base editor only contains the essentials; each developer then adds the tools that match the way they work. Two people using VS Code can thus have very different environments, tailored to their favorite language and habits.

The main families of extensions

To find your way among the multitude of available extensions, it helps to sort them into a few categories:

  • Languages: they add syntax coloring, suggestions and error detection for a specific language (Python, PHP, Java...).
  • Themes: they change the look of the editor (code colors, file icons).
  • Productivity tools: automatic formatting, typing shortcuts, local server, code checking...
  • Integrations: they connect VS Code to other services, such as Git, databases or deployment tools.

Accessing the extensions Marketplace

To browse and install extensions, click the icon shaped like assembled blocks in the Activity Bar (or use the shortcutCtrl/Cmd + Shift + X). The sidebar then displays a search field along with suggestions of popular extensions.

Extensions view in VS Code

To install an extension, type a keyword in the search bar, click the extension that interests you to see its detailed description, then click the blue Install button. Some extensions ask you to restart VS Code (or just reload the window) to be activated.

An extension's detail page is very informative: it presents a full description, screenshots, the list of features, the available settings and the version history. Always take the time to read it before installing, especially to understand what the extension will really change in your editor.

Choosing your extensions well

With thousands of sometimes similar extensions, how do you know which ones to install safely? A few simple criteria to check before installing:

  • The number of installs: an extension used by millions of people is generally reliable.
  • The average rating and the reviews: visible on the extension's page.
  • The publisher: favor extensions published by Microsoft (verification badge) or by well-known publishers.
  • The date of the last update: an extension that hasn't been updated in years may become incompatible.

An extension runs with broad permissions on your machine: it can read your files and run commands. That is why caution is called for. Be wary of unknown extensions, ones whose name is very close to that of a famous extension, or whose description is vague or full of mistakes. When in doubt, choose the most popular alternative.

A few essential extensions to get started

Here is a selection of extensions that are particularly useful when you're starting out in web development, which you can install right now:

  • Language Pack for your language (for exampleFrench Language Pack): fully translates the VS Code interface into your language.
  • Prettier – Code formatter: automatically reformats your code (indentation, spaces, quotes) according to consistent rules, with a keyboard shortcut.
  • Live Server: starts a small local server and automatically reloads your browser every time you save an HTML (or CSS or JavaScript) file — ideal for seeing your changes in real time.
  • Auto Rename Tag: automatically renames the closing HTML tag when you edit the matching opening tag.
  • Indent Rainbow: colors the indentation levels so you can more easily spot the nested structure of your code.

Take Live Server, which you will use very often. Without this extension, you have to save your file, switch to your browser then refresh the page by hand to see the result. With it, the page reloads by itself as soon as you save: you save time and immediately see the effect of each change.

Good to know

There's no need to install dozens of extensions on the first day: the more you enable, the more VS Code can slow down at startup. Install them as your real needs arise, and uninstall the ones you no longer use.

Managing your installed extensions

In the Extensions panel, an "Installed" section lists all the extensions present on your machine. For each one, you can temporarilydisable it (without uninstalling it), completelyuninstall it, or view its specificsettings via the small gear icon next to its name.

Extensions are updated automatically by default: a badge indicates when a new version is available or installed. If an extension behaves strangely after an update, you can disable it to check whether it is responsible, then re-enable it or go back to an earlier version from the gear icon ("Install Specific Version...").

If you work on several computers, the settings sync feature (available from the Accounts menu in the Activity Bar) lets you automatically get your extensions, themes and shortcuts back wherever you sign in.

You can also disable an extension only for the current project ("Disable (Workspace)"). This is handy when an extension is useful for one project but gets in the way in another.

Customizing with themes and icons

Extensions aren't only for adding features: they can also make your editor look better. By typing "theme" in the search, you will discover hundreds of color themes, light or dark. There are also icon extensions that display a different symbol for each file type in the Explorer, which helps you spot an HTML, CSS or JavaScript file at a glance. Once installed, a theme is activated from the Command Palette with "Preferences: Color Theme".

Installing an extension from the terminal

You can also install an extension without going through the interface, with the command code --install-extension followed by the extension's identifier, for example esbenp.prettier-vscode for Prettier. This method is mostly useful to advanced users, but it shows that everything you do with the mouse in VS Code can also be done from the keyboard. To list the extensions already installed, type code --list-extensions. These commands rely on thecode command being available in your terminal (see the previous lesson).

Using an extension day to day

Once installed, an extension is used in different ways depending on its role. Some work in the background, like syntax coloring or suggestions. Others add commands to the palette (Ctrl/Cmd + Shift + P), entries in the right-click menu or new icons in the Activity Bar. For example, to format a file with Prettier, useShift + Alt + F on Windows, Shift + Option + F on Mac, or Ctrl + Shift + I on Linux.

This shortcut runs VS Code's "Format Document" command, which uses the default formatter. The first time, VS Code may ask you to choose one: pick Prettier. You can also set it later from the right-click menu with "Format Document With...", then "Configure Default Formatter...".

To finish, keep a simple rule in mind: an extension should always meet a specific need. If you don't know what it will concretely be used for in your work, it is probably pointless to install it. A well-chosen editor, with five or six well-suited extensions, will always be more pleasant than an overloaded one. Don't hesitate to test, uninstall and start over: nothing is permanent.

Practical exercise

Open the Extensions panel and install the "Prettier – Code formatter" extension. Search for it by its exact name, read its description, then click "Install".

Going further

Also install "Live Server", open the index.html file you created in the previous lesson, right-click it in the editor and choose "Open with Live Server" to see the page appear in your browser.