Visual Studio Code extensions are plug-ins that enhance the editor's functionality through a rich JavaScript/TypeScript API. Extensions can add commands, UI components, language features, debugging support, AI-powered chat participants, and custom editors β essentially anything that customizes or extends the editing experience. The extension API is comprehensive and well-structured, allowing developers to build everything from simple commands to complex language servers and MCP-integrated AI tools, with contributions declared in package.json and runtime behavior implemented through activation events and the vscode namespace. Understanding the lifecycle (activation, execution, deactivation) and contribution model is key to building efficient, well-integrated extensions.
What This Cheat Sheet Covers
This topic spans 29 focused tables and 221 indexed concepts, 152 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Extension Manifest Configuration
The package.json manifest is the first file VS Code reads, and every extension begins here. These fields declare the identity that forms your publisher.name ID, the entry point that gets loaded, the engine version that gates which APIs you can call, and the marketplace metadata that decides how discoverable you are. Getting the required ones right β name, publisher, version, engines, main β is the difference between an extension that installs and one that's rejected.
| Field | Example | Description | |
|---|---|---|---|
"name": "my-extension" | β’ Unique identifier for the extension β’ must be lowercase alphanumeric with hyphens β’ used in extension ID as publisher.name. | ||
"displayName": "My Extension" | β’ Human-readable name shown in marketplace and Extensions view β’ can contain spaces and capitals. | ||
"publisher": "mycompany" | β’ Publisher identifier β’ must match your VS Code Marketplace publisher account β’ forms the full extension ID. | ||
"version": "1.0.0" | β’ Semantic version in major.minor.patch formatβ’ required for publishing and updates. | ||
"engines": { "vscode": "^1.85.0" } | β’ Minimum VS Code version required β’ uses semantic versioning range syntax β’ determines API availability. | ||
"main": "./out/extension.js" | β’ Entry point file path for extension activation β’ exports activate() and deactivate() functions. | ||
"activationEvents": ["onCommand:ext.hello"] | β’ Array of events triggering extension loading β’ use specific events instead of * for better performance. | ||
"contributes": { "commands": [...] } | β’ Declares UI contributions (commands, menus, views, etc.) β’ defines what the extension adds to VS Code. | ||
"categories": ["Programming Languages"] | β’ Marketplace categories for discovery β’ use predefined values like Formatters, Linters, Debuggers. | ||
"keywords": ["python", "linter"] | β’ Search terms for marketplace β’ improves discoverability β’ maximum 5 recommended. | ||
"icon": "images/logo.png" | β’ Relative path to the extension icon (128Γ128 PNG) β’ displayed in marketplace and Extensions view. | ||
"repository": { "type": "git", "url": "https://github.com/..." } | β’ Source code repository URL β’ enables "Repository" link in marketplace. | ||
"l10n": "./l10n" | β’ Path to folder containing bundle.l10n.{locale}.json translation filesβ’ required for multi-language extension support. |