xps / VSTextMacros

An extension for Visual Studio 2012-2022 that brings back support for macros in text/code editors
https://marketplace.visualstudio.com/items?itemName=XavierPoinas.TextMacrosforVisualStudio201220132015
Other
69 stars 20 forks source link

Undo of all played macro commands at once #20

Closed myss closed 7 years ago

myss commented 7 years ago

I have created a complex macro that includes text inserts, deletions, cut and paste. If I execute the macro and want to undo it, I have to press ctrl-Z multiple times. I think that it would be better if everything would be undone at once.

ygoe commented 7 years ago

There seems to be an object named something like EnvDTE.UndoContext that has Open(actionLabel) and Close() methods as well as an IsOpen property. But I can't figure out where to get that instance from.

It would likely go into the MacroCommandFilter.Playback method. Unfortunately I can't try out this extension because Visual Studio 2015 won't start it. (I'd expect it to run it in an experimental VS instance but this one doesn't work.)

ygoe commented 7 years ago

Just tried it without the safety net, and it worked. MSDN told me where to get the required parts.