Visual Studio : exclude outlining from undo/redo stack

前端 未结 6 1398
既然无缘
既然无缘 2021-02-03 22:16

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

6条回答
  •  长情又很酷
    2021-02-03 22:45

    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.

提交回复
热议问题