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

让人想犯罪 __ 提交于 2019-11-29 20:06:33
Myz

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

Brendon Vdm

Ctrl+M+O will collapse all.

Ctrl+M+L will expand all. (in VS 2013 - Toggle All outlining)

Ctrl+M+P will expand all and disable outlining.

Ctrl+M+M will collapse/expand the current section.

These options are also in the context menu under Outlining.

Right click in editor -> Outlining to find all options. (After disabling outlining, use same steps to enable outlinging.)

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

tick the Checkmark in Settings -> TextEditor -> C# -> Advanced -> Collapse #regions when collapsing definitions.

then right click in the editor > outlining > collapse to defenitions

AzNjoE

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

TheJonz

I recommend using the free Visual Studio extension "Menees VS Tools Extension for Visual Studio." Just search for it in Tools --> Extensions and Updates in Visual Studio. Once installed you just have to hit Ctrl+M+K and just the regions will be collapsed. Here is their website https://marketplace.visualstudio.com/items?itemName=BillMenees.MeneesVSTools2013

To edit the settings look under Tools --> Options --> Menees VS Tools --> General.

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.

Select All via Ctrl A and then Ctrl M M

i.e. Press M twice while holding down Ctrl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!