Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to improve code folding in Visual Studio? [duplicate]

I want some automatic code folding for if(),try() etc.

It should be some code editor feature (like one in VS for methods, etc).

If I have this:

-        public frmMain()
|        {
|           InitializeComponent();
|           if (true)
|           {
|                try ()
|                {
|                }
|                catch()
|                {
|                }
|            }
|        }

I want to get this:

-        public frmMain()
|        {
|           InitializeComponent();
-           if (true)
|           {
-                try ()
|                {
|                }
-                catch()
|                {
|                }
|            }
|        }

Even Notepad++ can do this!

like image 443
user230752 Avatar asked Dec 17 '09 18:12

user230752


2 Answers

For C#;

  1. Tools, Options, Text Editor
  2. Expand C/C++
  3. Advanced
  4. Outlining -> Turn on Enter outlining mode when files open

For C/C++;

  1. Tools, Options, Text Editor
  2. Expand C/C++
  3. Formatting
  4. Outlining -> Turn on Enable Outlining & Outline Statement Blocks

Tested in VS2010

like image 153
RJFalconer Avatar answered Oct 16 '22 10:10

RJFalconer


I don't normally post things I've not personally used, but in this case, I was able to find an add-in that Jay Flowers wrote which seems to do exactly what you want. Currently, it can be located and downloaded here, with source in case you wanted to add more features or change its functionality.

like image 21
John Rudy Avatar answered Oct 16 '22 12:10

John Rudy