Collapse all #regions only(!) in C# (Visual Studio)

前端 未结 10 1670
予麋鹿
予麋鹿 2020-12-12 15:11

There\'s a number of keyboard shortcuts and menu commands to automatically expand or collapse all foldables in the current document. Ctrl+M, Ctrl

相关标签:
10条回答
  • 2020-12-12 16:06

    in Visual Studio 2017 I have to activate 'Collapse #regions when collapsing to definitions' in

    Tools -> Options -> Text Editor -> C# -> Advanced

    explicitly to collapse all when pressing Ctrl+M+O

    0 讨论(0)
  • 2020-12-12 16:11

    I dont know if this is new, but there is a setting for the c# text edior:

    Settings -> TextEditor -> C# -> Advanced -> Collapse #regions when collapsing definitions.

    When its set CtrlM CtrlO will collapse the #regions.

    0 讨论(0)
  • 2020-12-12 16:12

    The Visual Studio extension Productivity Power Tools 2015 from Microsoft has a feature called Quick Launch Tasks that adds new commands to the Quick Launch menu. One of them is CollapseRegions and it does exactly that.

    The opposite command is ExpandRegions and it expands all regions for quick browsing of the entire file. These commands can be used pretty quickly by pressing the CtrlQ hotkey and typing Coll resp. Exp, then pressing Enter (supposed you don't have other commands with the same prefix).

    0 讨论(0)
  • 2020-12-12 16:13

    Looks like the closest thing is Ctrl+M, Ctrl+S

    Which will collapse the current region you are in, while Ctrl+M, Ctrl+E will expand the current region you are in.

    List of default keyboard shortcuts:

    https://msdn.microsoft.com/en-us/library/da5kh0wa(v=vs.140).aspx

    0 讨论(0)
提交回复
热议问题