Hiding the regions in Visual Studio

KevinT picture KevinT · May 13, 2009 · Viewed 11.6k times · Source

I know VS code folding issues are an old chestnut, but I haven't been able to find this in all the other discussions I have browsed through:

We have a team of C# guys, some love regions and others hate them and we don't seem to have much middle ground to work with.

Is there a plug- or add-in for VS that will just 'hide' the regions? So that those that want them will see them as normal, but the people that install the add-in and view a .cs file the regions just aren't there, as if they don't exist.

I can see this might be an issue when moving code around that it might cause issues of certain methods being in or outside of the wrong region, but that might be a tradeoff the team is happy with...

Answer

NotDan picture NotDan · May 30, 2011

I hate regions (my team loves them) and was surprised to find that nobody has written an extension to make them better. I finally wrote one myself called I Hate #Regions:

Make #regions suck less (for free):

http://visualstudiogallery.msdn.microsoft.com/0ca60d35-1e02-43b7-bf59-ac7deb9afbca

  • Auto Expand regions when a file is opened
  • Optionally prevent regions from being collapsed (but still be able to collapse other code)
  • Give the #region / #end region lines a smaller, lighter background so they are less noticeable (also an option)
  • Works in C# and VB

Region Tool Screenshot