Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const doInitialization: BackendInitializationFn = (rpc: any, pluginMetadata: PluginMetadata) => {
const module = require('module');
const vscodeModuleName = 'vscode';
const vscode = createAPI(rpc);
// register the commands that are in the package.json file
const contributes: any = pluginMetadata.source.contributes;
if (contributes && contributes.commands) {
contributes.commands.forEach((commandItem: any) => {
vscode.commands.registerCommand({ id: commandItem.command, label: commandItem.title });
});
}
// replace command API as it will send only the ID as a string parameter
vscode.commands.registerCommand = function registerCommand(command: any, handler?: (...args: any[]) => T | Thenable): any {
// use of the ID when registering commands
if (typeof command === 'string' && handler) {
return vscode.commands.registerHandler(command, handler);
}
};