简体   繁体   中英

Visual Studio 2015 - auto-collapse #regions and inactive code

In every version of Visual Studio up to 2013, code wrapped in #region s and inactive code in #if statements are automatically collapsed when you open a C# code file for the first time, when "enter outlining mode when files open" is enabled.

I'm trying to figure out how to enable this in Visual Studio 2015 RC, but even turning on "enter outlining mode when files open" doesn't seem to have any effect. If anything, it seems that the file opens, and then VS activates outlining mode a split second later, without checking to see if anything needs to be collapsed.

好吧,看起来自动折叠功能在 VS2015 Update 1 中再次起作用,所以现在的答案似乎是“安装 Update 1”。

Visual Studio 2015 does not currently have this functionality built in.

You might want to check out the I Hate #Regions extension. It can automatically expand regions when opening a file.

It looks like it's still a problem with VB, not C#:

" Incorrect VB code collapsing in VS2015 update 1 #9189 "

https://github.com/dotnet/roslyn/issues/9189

It's still broken in Update 3, so hopefully they address it in Update 4.

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