简体   繁体   中英

How do I stop Auto Outline Expansion in Visual Studio 2010?

How to do I stop Visual Studio 2010 from expanding outlines/regions automatically?

Right now whenever I create certain syntax errors (usually while editing, sometimes just from starting to type new code), it will auto expand every outline/region below that line.

I've been through the formating settings, but I can't find anything. Maybe I don't know the proper terminology that applies to the setting.

Example code that causes this behavior(one of many):

public string myMethod1(string myStr)
{
    try //<-SELECT AND DELETE ME 
    {   //<-AND ME TOO, AT THE SAME TIME

        return myStr + "success"; 
    }
    catch
    {
        return myStr + "failed"; 
    }
}

//ALL OF THESE BELOW WERE COLLAPSED, 
//BUT WILL EXPAND WHEN "TRY {" IS DELETED
#region HIDING
public string myMethod2(string myStr) { /*...*/ }
public string myMethod3(string myStr) { /*...*/ }
public string myMethod4(string myStr) { /*...*/ }
public string myMethod5(string myStr) { /*...*/ }
#endregion HIDING  

Thanks for any help!

EDIT:
I can force to happen by removing any starting bracket { , anywhere in my code.

This is not normal behavior. It is possible that an add-on you have installed is incorrectly doing this. You can reset your environment to the default settings by going to Tools -> Import and Export Settings ...

  • choose Reset all settings
  • click next
  • save your current settings if you want to
  • then choose the default setting (I prefer General Development Settings because I work on lots of different things)
  • Click finish

Saving your current settings allows you to keep your old stuff in case you do not like what defaults you have chosen. So there is really no chance for loss of your environment setup when you do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM