A batteries-included template for building VS Code extensions with TypeScript.
- TypeScript (CommonJS, ES2022) —
tsconfig.json/tsconfig.test.json - Vitest with a
vscodeAPI mock —vitest.config.ts,__mocks__/vscode.ts - ESLint + Prettier —
eslint.config.mjs,.prettierrc.json,.prettierignore - Husky + commitlint — pre-commit (lint + format) and Conventional Commits enforcement
- GitHub Actions — CI (lint / format / type-check / test with 100% coverage), PR title check, and release-please with Marketplace and Open VSX publishing
- Dev Container —
.devcontainer/devcontainer.json - Hello World sample —
src/extension.tswith a registered command and a matching test
-
Click Use this template on GitHub to create your repository (or clone this repo).
-
Update
package.json:name,displayName,description,publisher, and thecontributessection. -
Implement your extension in
src/extension.ts. -
Install dependencies and run the checks:
npm install npm run lint npm run format:check npm run compile npm run test:coverage
Note:
npm installgeneratespackage-lock.json. Commit it — the CI usesnpm ci, which requires a lockfile. Generate it inside the dev container (Linux) so every platform's optional native dependency is recorded; otherwise the CI test step can fail with a missing native binding. -
Press
F5in VS Code to launch the Extension Development Host and try the Hello World command.
The release-please workflow opens a release PR from your Conventional Commits and, on merge, publishes to the VS Code Marketplace and Open VSX Registry. Set these repository secrets:
RELEASE_PLEASE_PAT— a PAT for release-please to open release PRsVSCE_PAT— a Marketplace token for publishingOVSX_PAT— an Open VSX token for publishing
The CI workflow enforces 100% test coverage and, if the CODECOV_TOKEN
repository secret is set, uploads coverage results to Codecov.
| Script | Description |
|---|---|
npm run compile |
Type-check and build to out/ |
npm run watch |
Incremental build |
npm test |
Run tests with Vitest |
npm run test:coverage |
Run tests with a coverage report |
npm run lint |
Lint src/ |
npm run format |
Format with Prettier |
npm run package |
Build a .vsix |
MIT