been seeing a lot command not found issue duringt the vscode extension development.
after all the code to register the command, and expose to menu and keybindings, turns out it needs to be activated as well (hence to call the register command):
https://stackoverflow.com/a/57620155/410289
We still need to call registerCommand to actually tie the command id to the handler. This means that if the user selects the myExtension.sayHello command from the Command Palette but our extension has not been activated yet, nothing will happen. To prevent this, extensions must register an onCommand activationEvent for all user facing commands:
{
"activationEvents": ["onCommand:myExtension.sayHello"]
}
Now when a user first invokes the myExtension.sayHello command from the Command Palette or through a keybinding, the extension will be activated and registerCommand will bind myExtension.sayHello to the proper handler.
You do not need an onCommand activation event for internal commands but you must define them for any commands that:
Can be invoked using the Command Palette.
Can be invoked using a keybinding.
Can be invoked through the VS Code UI, such as through the editor title bar.
Is intended as an API for other extensions to consume.