xml/xdt transforms in NuGet use the file system, which leads to the 'would you like to reload this document' dialog. If you had pending changes in the editor, you have to either throw them away, or throw away whatever the transform did to your file. Since there's no editor integration, the result of the xml transform is based on what's saved on disk, not what the user has in the editor.
NuGet in VS can solve this by getting the text from the editor. By using the editor to perform the save (instead of the file system), you avoid having to reload the document, and get undo support.
For legal reasons I'm unable to submit a PR, but the following public interfaces of VS could get you started:
Use IVsRunningDocumentTable (from shell service provider) to find the document
The value pointed to by the docData parameter can be converted to an IVsTextBuffer
The IVsEditorAdaptersFactoryService (from mef) can convert IVsTextBuffer into the wpf-editor family of interfaces.
NuGet in VS can solve this by getting the text from the editor. By using the editor to perform the save (instead of the file system), you avoid having to reload the document, and get undo support.
For legal reasons I'm unable to submit a PR, but the following public interfaces of VS could get you started:
Use IVsRunningDocumentTable (from shell service provider) to find the document
The value pointed to by the docData parameter can be converted to an IVsTextBuffer
The IVsEditorAdaptersFactoryService (from mef) can convert IVsTextBuffer into the wpf-editor family of interfaces.