Loading...
Loading...
Comprehensive guide for creating VS Code extensions from scratch, including project scaffolding, API usage, activation events, and packaging. Use when user wants to create/build/generate/develop a VS Code extension or plugin, asks about VS Code extension development, needs help with VS Code Extension API, discusses extension architecture, wants to add commands/webviews/language support, or mentions scaffolding a VS Code project.
npx skill4agent add kjgarza/marketplace-claude vscode-extension-buildernpx --package yo --package generator-code -- yo codevsce packagenpx --package yo --package generator-code -- yo codeassets/templates/command-extension/language-support/webview-extension/package.json{
"contributes": {
"commands": [{
"command": "extension.commandId",
"title": "Command Title"
}]
}
}extension.tsexport function activate(context: vscode.ExtensionContext) {
let disposable = vscode.commands.registerCommand('extension.commandId', () => {
vscode.window.showInformationMessage('Hello from Extension!');
});
context.subscriptions.push(disposable);
}onCommandonLanguageonView*package.jsoncommandsmenuskeybindingslanguagesviewsconfigurationF5@vscode/test-electroncontributes.commandspackage.jsonnpm install -g @vscode/vsce
vsce package.vsixvsce publishvscode.commands.registerCommand('extension.showInfo', () => {
vscode.window.showInformationMessage('Information message');
});vscode.commands.registerCommand('extension.greet', async () => {
const name = await vscode.window.showInputBox({
prompt: 'Enter your name'
});
if (name) {
vscode.window.showInformationMessage(`Hello, ${name}!`);
}
});vscode.commands.registerCommand('extension.processFile', () => {
const editor = vscode.window.activeTextEditor;
if (!editor) {
vscode.window.showErrorMessage('No active editor');
return;
}
const document = editor.document;
const text = document.getText();
// Process text...
});const statusBarItem = vscode.window.createStatusBarItem(
vscode.StatusBarAlignment.Right,
100
);
statusBarItem.text = "$(check) Ready";
statusBarItem.show();
context.subscriptions.push(statusBarItem);package.json*package.jsonmainDeveloper: Reload Windowpackage.jsonactivate()npm install@types/vscodeonCommandonLanguage:mylangonView:myViewonCommandshowQuickPickdetect-code-smellssecurity-pattern-checksuggest-performance-fixassets/