From vscode-api
VS Code Extension API documentation - use when building VS Code extensions, registering commands, creating webviews, tree views, language features, or integrating with VS Code
How this skill is triggered — by the user, by Claude, or both
Slash command
/vscode-api:vscode-apiThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Comprehensive assistance for building Visual Studio Code extensions.
Comprehensive assistance for building Visual Studio Code extensions.
This skill should be triggered when:
# Generate extension scaffold
npx --package yo --package generator-code -- yo code
# Or with global install
npm install --global yo generator-code
yo code
my-extension/
├── package.json # Extension manifest
├── src/
│ └── extension.ts # Entry point
├── .vscode/
│ └── launch.json # Debug configuration
└── README.md
import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
// Register a command
const disposable = vscode.commands.registerCommand(
'myext.helloWorld',
() => {
vscode.window.showInformationMessage('Hello World!');
}
);
context.subscriptions.push(disposable);
}
export function deactivate() {}
{
"name": "my-extension",
"displayName": "My Extension",
"version": "0.0.1",
"publisher": "my-publisher",
"engines": { "vscode": "^1.85.0" },
"activationEvents": [],
"main": "./out/extension.js",
"contributes": {
"commands": [{
"command": "myext.helloWorld",
"title": "Hello World"
}]
}
}
| Namespace | Purpose |
|---|---|
vscode.commands | Register and execute commands |
vscode.window | UI elements, editors, notifications |
vscode.workspace | Files, folders, configuration |
vscode.languages | Language features, diagnostics |
vscode.debug | Debugging sessions, breakpoints |
vscode.env | Environment info, clipboard |
vscode.authentication | Auth providers and sessions |
vscode.chat | Chat participants (AI) |
vscode.lm | Language model interactions |
const cmd = vscode.commands.registerCommand('ext.myCommand', (arg) => {
vscode.window.showInformationMessage(`Received: ${arg}`);
});
context.subscriptions.push(cmd);
// Comment current line
vscode.commands.executeCommand('editor.action.addCommentLine');
// Go to definition
vscode.commands.executeCommand('vscode.executeDefinitionProvider', uri, position);
const result = await vscode.window.showQuickPick(
['Option 1', 'Option 2', 'Option 3'],
{ placeHolder: 'Select an option' }
);
const input = await vscode.window.showInputBox({
prompt: 'Enter your name',
placeHolder: 'Name'
});
// Read
const config = vscode.workspace.getConfiguration('myext');
const value = config.get<boolean>('enableFeature');
// Write
await config.update('enableFeature', true, vscode.ConfigurationTarget.Global);
const output = vscode.window.createOutputChannel('My Extension');
output.appendLine('Starting...');
output.show();
vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
title: 'Processing...',
cancellable: true
}, async (progress, token) => {
progress.report({ increment: 50, message: 'Halfway done' });
await doWork();
});
| Point | Purpose |
|---|---|
commands | Define commands for Command Palette |
menus | Place commands in context menus |
configuration | Extension settings |
keybindings | Keyboard shortcuts |
views | Sidebar tree views |
viewsContainers | Activity bar/panel containers |
languages | Language registration |
grammars | TextMate syntax highlighting |
snippets | Code snippets |
themes | Color themes |
customEditors | Custom editor implementations |
debuggers | Debug adapters |
taskDefinitions | Task types |
walkthroughs | Onboarding guides |
| Event | Trigger |
|---|---|
onCommand:ext.cmd | Command invoked |
onLanguage:python | File of language opened |
onView:myView | View expanded |
workspaceContains:**/*.py | Matching file in workspace |
onFileSystem:sftp | URI scheme accessed |
onStartupFinished | After VS Code starts |
* | Immediate (avoid if possible) |
| Type | Scope | Use Case |
|---|---|---|
context.workspaceState | Per workspace | Workspace-specific data |
context.globalState | All workspaces | User preferences |
context.storageUri | Per workspace | Large files |
context.globalStorageUri | All workspaces | Shared files |
context.secrets | Encrypted | API keys, tokens |
// Read/write state
const value = context.globalState.get<string>('key');
await context.globalState.update('key', 'new value');
// Store secrets
await context.secrets.store('apiKey', 'secret123');
const secret = await context.secrets.get('apiKey');
This skill includes documentation in references/:
context.subscriptionsnpx claudepluginhub greglamb/claude-gcode-tools --plugin vscode-apiGuides VS Code extension development from scaffolding to Marketplace publication, covering commands, Webviews, TreeViews, testing, packaging, and troubleshooting.
Guides VS Code extension installation in Cursor IDE using Open VSX, VSIX files, CLI commands; resolves AI conflicts and recommends essentials.
Guides adding custom IntelliSense completion items to Visual Studio via MEF-based VSSDK/VSIX extensions. Covers completion sources, providers, content types, and MEF asset declarations.