This guide is for Windows env, in Pwsh, because VS Code should run there instead of WSL, may fail if inside WSL.
- On GitLab, GitHub or somewhere else
Clone the repo to local
- git clone...
Go to project folder to install libs
- npm initnpm 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
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