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!
For VS2008, it's under Tools – Options – Text Editor – C/C++ - Formatting - Enter outlining mode when files open. Show activity on this post. Then under > Outlining , set Enable Outlining to False.
From the Visual Studio's Edit menu. Clicking the undo and redo icons on the toolbar. Pressing CTRL+Z for undo and CTRL+Y for redo.
When user want to undo those operations, simply pop operations from the "performed" stack to a "recall" stack. When user wants to redo those operations, pop items from "recall" stack and push them back to "performed" stack.
So, if you've just taken a step in live debugging (F10 or F11), you can use the Step Backward button to quickly navigate to the previous step. This will automatically put Visual Studio in Historical debugging mode, at the line of code you've stepped back to.
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!
I did a little poking around and discovered that there is in fact an option in Visual Studio to disable this behavior, and yet it does not seem to be exposed anywhere in the user interface. However, you can set it programmatically, and I tested that it does work, so it is (technically) possible.
The options is:
DefaultTextViewOptions.OutliningUndoOptionId
and you set it like this:
textView.Options.SetOptionValue(DefaultTextViewOptions.OutliningUndoOptionId, false);
With this information a very simple Visual Studio extension could be written to toggle this setting for all new ITextView
instances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With