Create your own VSCode Extension

  • Install Node.js with npm or yarn

  • Install Yo with generator for VSCode extension npm install -g yo generator-code or yarn global add yo generator-code

  • Create new project yo code

VSCode Extension generator


  • Create Azure DevOps account and get a Personal Access Token

  • npm install -g vsce

  • vsce create publisher [name]

  • vsce package

  • vsce publish

Testing Extension

End-to-end testing is not doable (yet), so that you cannot make clicks or typing commands. To test typing command arguments I use Sinon stub instead.

// This mock clicking "Yes" label when your command runs and open Quick Pick dialog.
let quickPickStub = stub(vscode.window, "showQuickPick")
quickPickStub.resolves({ label: 'Yes' })
await vscode.commands.executeCommand('extension.your.command.name')

Try separating the business logic and interaction with VS Code, then the logic can be tested with normal Javascript testing.