Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
registerCommand(id: string, callback: (...args: any[]) => any, thisArg?: any): Disposable {
const execute = callback.bind(thisArg);
const removeCommand = this.registry.registerCommand({ id: id }, {
execute: () => {
const currentEditor = this.editorManager.currentEditor
if (this.isYangEditor(currentEditor)) {
execute(currentEditor.editor.document.uri)
}
},
isVisible: () => this.isYangEditor(this.editorManager.currentEditor)
});
const removeMenu = this.menuRegistry.registerMenuAction(EDITOR_CONTEXT_MENU.concat("2_yang"), {
commandId: id,
label: id
});
return {
dispose : () => {
removeCommand.dispose()
removeMenu.dispose()
}
}
}