VS Code

Develop VS Code extension

Introduce how to develop an extension for VS Code.

This page only records some of the key steps and commands. If you want to learn more details, please refer to your-first-extension to get started.

  1. Install Node.js , git and npm.
  2. Then install yeoman and Vs Code generator code with npm command.

Below are the installation steps in Linux.

sudo apt install nodejs
sudo apt install git
sudo apt install npm
sudo npm install -g yo generator-code

  • Run yo code.
    This command scaffolds a TypeScript or JavaScript project ready for development.
  • Develop your extension.
  • Press F5 in the VS Code editor. This will compile and run the extension in a new Extension Development Host window.
  • Run the command you designed from the Command Palette (CtrlShiftp) in the new window.
I have found a way to develop extensions using Python. However, it was archived because the author did not have time to maintain it. Please refer to vscode-ext.
  • Run vsce package in the root directory to package an extension.
  • Run vsce publish in the root directory to publish an extension.
  • Run code –install-extension /path/to/ext.vsix to install an extension.
  • Run code –list-extensions to list the ext-id of the installed extensions.
  • Run code –uninstall-extension ext-id to uninstall an extension.

Example

  • Extension-manifest
    The details of some fields in package.json are listed here.
  • VS Code API
    This page lists all VS Code APIs that you can invoke in your Visual Studio Code extension.
G C S E K