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 met
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.