Terms in Graph Data and Tree Data

Graph is the generalized version of tree, and tree is the special case in graph. Terms in graph and tree are different too, to avoid confusi...

09 August, 2025

How to Create VS Code Extension

This guide is for Windows env, in Pwsh, because VS Code should run there instead of WSL, may fail if inside WSL.

Create repository for project
  • On GitLab, GitHub or somewhere else
Clone the repo to local
  • git clone...
Go to project folder to install libs
  • npm init
    npm install -g yo generator-code
Generate the project PROJNAME
  • yo code
Rename (because the repo name is already the project name)
Note: Load the 'src' dir instead of its parent dir to VS Code or Run and Debug (F5) won't work.
  • mv PROJNAME src
Yeoman (yo) may make mismatching versions for the actual VS Code installed, for my case was 1.103 as dependencies for the extension while my VS Code app is 1.102 after updating again and again with no such 1.103. So edit the package.json file created by Yeoman, in 'src' dir:
  • engines.vscode
  • devDependencies.@types/vscode
Edit the version of the being-created extension in package.json too, the initial version should be 0.1.0 instead of 0.0.1 'cause it's the first minor code being created, not first patch.

Run the extension in separate VS Code window 'cause the src folder is inside project folder which VS Code will think the parent of 'src' folder is the extension folder and fails to load.
  • cd src
  • code .
Run the extension
  • Click 'Run and Debug' button on left rim of VS Code
  • Click Run (F5)
Package to .vsix file to use and publish
  • npm i -g vsce
  • vsce package

No comments:

Post a Comment