Visual-studio – Visual Studio : exclude outlining from undo/redo stack

ideoutliningundovisual studio

There's something really annoying in Visual Studio : when I expand or collapse a method or code region, this action is pushed on the undo stack. So if I edit some code in a method, then collapse that method, and then want to undo my change, I have to undo twice : once for the collapse action, and once for the change in code. This can be VERY confusing if you expanded or collapsed several things after editing the code, the editor keeps jumping to different places and you don't know whether your changes have been undone or not…

So my question is : is it possible to disable that behavior ? i.e., that only changes in code are taken into account in the undo stack ?

PS: I'm using Visual Studio 2008


If this behavior annoys you too, please vote to fix it on UserVoice!

Best Answer

I've created the Disable Outlining Undo extension that excludes expanding and collapsing operations from recording to the undo/redo stack in Visual Studio 2017/2019.

Thanks to Rick Sladkey for the idea!