Reputation: 63
I have an instance of monaco editor running inside an iFrame inside of an angular 1.5 application. Whenever I load the editor, I use registerCompletionItemProvider
to register a custom completion item.
However, when the editor is loaded for a second time, the completion item is registered again and I get duplicate completion items. This happens each successive time that I load the editor. I don't know when the user is going to navigate away from the editor, and my controller does not have access to the monaco editor's dispose()
method. How can I ensure that I don't continue to re-register existing completions?
Thanks!
Upvotes: 1
Views: 2267
Reputation: 21
The return value of registerCompletionItemProvider provide dispose method. You can dispose it when the editor is unmount.
Upvotes: 2