I have built a VSPackage that projects text from an IVsInvisibleEditor
. This IVsInvisibledEditor
corresponds to a file that the user has opened within Visual Studio and exists within a Document Window.
When the user closes this Document Window, it removes a number of properties from the underlying ITextBuffer
. In particular it removes the ITextDocument
property from the source ITextBuffer
.
I would like to prevent this, as the user may be using my extension to continue editing the document. When the primary document editor is closed, the removal of these properties prevents keystrokes from being recognized within my custom editor.
How can I detect when Visual Studio is closing a document window? I've explored the EnvDTE class and I've noticed the DocumentEvents class, but it's marked as Microsoft-internal.
Is there a public API where I can detect when document windows are closed?