How to programmatically trigger a VS Code extension command and see its UI effects?
I'm learning VSCode extension development and want to run a command I defined from within the extension.
Here is my code:
const vscode = require('vscode');
/**
* @param {vscode.ExtensionContext} context
*/
function activate(context) {
console.log('Congratulations, your extension "cli-runner-by-blueray453" is now active!');
const disposable = vscode.commands.registerCommand('extension.cli-runner-by-blueray453', function () {
vscode.window.showInformationMessage('Hello World from cli-runner-by-blueray453!');
});
context.subscriptions.push(disposable);
setTimeout(() => {
vscode.commands.executeCommand('extension.cli-runner-by-blueray453');
}, 3000);
}
function deactivate() {
console.log('CLI Runner extension deactivated.');
}
module.exports = {
activate,
deactivate
}
However, After 3 seconds, the command does not display the information message window.
What is the proper way to programmatically trigger a command and see its UI effects during development?