Building a VS Code extension in 2026 is a one-evening project for a working developer. The API surface is large but well-shaped, the tooling generates a working starter in two minutes, and the marketplace publishing flow is a single command. The trick is knowing which API surface to touch — and which to leave alone.
This guide walks through the path that ships.
What changed in 2026
VS Code's extension API kept growing.
- Language Model API is GA. Extensions can call Copilot's models with the user's existing entitlement.
- Chat participants are first-class. Custom
@you commands inside the chat view.
- Web extensions are mainstream. The same code can run in vscode.dev with a small extra config.
How we picked the path
Five steps that map to a working extension.
- Generate with
yo code
- Pick the smallest API that does the job
- Test in a fresh extension host
- Package with
vsce package
- Publish with
vsce publish
1. Generate the starter
Install yo and generator-code. Run yo code, pick "New Extension (TypeScript)", give it a name. You get a working extension with a sample command, a test runner, and a launch config. Run "Run Extension" from VS Code's debugger and a second window opens with your extension loaded.
The trade-off: the generator uses npm by default. If you prefer pnpm or Bun, swap the package manager after generation.
2. Pick the right API surface
The most common APIs in 2026:
- Commands — bind a function to a palette entry or keybinding.
- Tree views — sidebar lists. Lightweight and fast.
- Code actions and quick fixes — light-bulb suggestions in the editor.
- Language Model API — call Copilot models with the user's entitlement.
- Chat participant — register an
@you handler in the chat panel.
Avoid webviews unless you need actual HTML rendering. They cost startup time and the message-passing API is fiddly.
3. Test before you publish
Run the extension in the integrated debugger. Then run it in a fresh user-data directory (code --extensionDevelopmentPath=. --user-data-dir=/tmp/test) to catch state-related bugs. Check activation events — extensions that activate on * slow down editor startup for every user.
4. Publish
Create a publisher on the Marketplace, generate a personal access token in Azure DevOps. Run vsce package to produce a .vsix, then vsce publish to upload it. Each new version is live within minutes.
Comparison: Extension API surfaces in April 2026
| API |
Complexity |
Performance cost |
Best for |
| Commands |
Low |
None |
Everything starts here |
| Tree views |
Low |
Low |
Sidebar UIs |
| Status bar |
Very low |
None |
Quick info |
| Webview |
High |
High |
Real HTML UIs only |
| Language Model |
Medium |
Depends |
AI-powered features |
Common mistakes to avoid
Activating on *. Every user pays for your extension's startup time. Use specific activation events.
Building a webview when a tree view fits. Webviews look impressive in screenshots and feel slow in daily use.
Forgetting engines.vscode. Pin a minimum VS Code version. New API breaks old VS Code. Old API breaks new behavior.
FAQ
Can my extension call OpenAI directly?
Yes, but you must handle the user's API key yourself. The Language Model API is the easier path because it uses the user's existing Copilot entitlement.
Will my extension work in Cursor?
In most cases yes — Cursor is a VS Code fork and supports the same extension API.
How do I monetize an extension?
The Marketplace itself does not handle payments. Most paid extensions use a license-key flow with an external payment provider.
Where to go next
For related guides see Best VS Code extensions in 2026, Best AI coding assistants in 2026, and How to use Claude for coding in 2026.