Visual Studio : exclude outlining from undo/redo stack

前端 未结 6 1354
既然无缘
既然无缘 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 23:04

    I don't believe there is a way to disable this behavior.

    As alternatives, the undo and redo toolbar icons have history dropdowns that allow you to visually see a summary of what the recent changes were that you would be undoing or redoing. That can sometimes help to ensure you're undoing (or redoing) what you're expecting.

    Since that isn't always enough to know exactly what the changes are (the undo history only displays a summary), the solution I occasionally use to address this is to combine undo (ctrl-z), redo (ctrl-y), and undo again. The first undo moves to where the change happened (and undoes that change). The redo will undo the undo (which essentially repeats the last change made). And the last undo will perform the undo again with the window scrolled to the location where I can actually see the undo happening and can confirm whether that's the change I was expecting to undo. It's not very efficient, but it can be very effective to ensure the code is in state that's really expected.

提交回复
热议问题