Davo.net

I like to see my code collapse down to regions when code is open, this is how I work in VS 2003, but in VS 2005 where I have "Enter outlining mode when files open" set to the default value or true.

Turned on via (Text Editor-C#-Advanced).

When I open up a new code window, the code does not collapse.

Am I missing something or is this a VS 2005 bug.

Cheers Dave



Re: Visual C# IDE "Enter outlining mode when files open" Does not work in Visual Studio 2005

Dylan Lingelbach MSFT

Dave,

I moved your post to the C# thread as this is a C# specific question and will best be answered on this forum.

Thanks,

Dylan






Re: Visual C# IDE "Enter outlining mode when files open" Does not work in Visual Studio 2005

Anson Horton

Dave,

It is a bit confusing, but the behavior you're seeing is intended. The feedback that we received with VS 2003 was that we should persist the outlining state of source files after they have been closed and then reopened. The option in Tools | Option now effectively means what the default behavior should be for a file that you have never opened before. It has no effect on files that you have opened previously, since those files already have a persisted outlining state.

Anson Horton
C# IDE PM






Re: Visual C# IDE "Enter outlining mode when files open" Does not work in Visual Studio 2005

PompeyPaul

Personally, I hate the new behavior. It effectively means that I have to remember to manually collapse all regions before closing each file. Otherwise, very soon, all regions are expanded, making the use of regions completely useless. I don't think this change was properly thought through. At least we should have been given the option not to persist the outlining state.

Paul.





Re: Visual C# IDE "Enter outlining mode when files open" Does not work in Visual Studio 2005

Jax Developer

It persists some of the time. I preferred the 2003 way too. Only if we could get the commands: "Collapse to Region" that would collapse all the region in a source file and "Collapse to Method" that would collapse all the methods so we have kind of an index of all the methods in a source file while opening only the methods we're actually working on. On the same subject of navigating in the code, I don't remember in which version it stopped working but at some point, the memberí»s combo was editable where you could partially type the start of the member name until you hit the one you want then press enter to go to it. Now it goes only to the first letter, extremely ineffective and unproductive.



Re: Visual C# IDE "Enter outlining mode when files open" Does not work in Visual Studio 2005

Rich Howard

Add my vote for this too. There really needs to be an option to open files all outlines closed no matter how it was last saved. I waste a too much time closing outlines as well.

Rich





Re: Visual C# IDE "Enter outlining mode when files open" Does not work in Visual Studio 2005

Sumo

Me too. This is rubbish! Boo! Please add this back (as an additional option) in VS2008. Thanks.




Re: Visual C# IDE "Enter outlining mode when files open" Does not work in Visual Studio 2005

TaylorMichaelL

While I can't justify the reasoning behind the decision I can agree with it. You are approaching this from your own POV which is an indication of how you code whereas others may code differently and therefore have a completely different POV. In your case I would wager that you open a file, make some changes, save the file and go on to your next task. For this usage scenario it would make sense to always collapse back to definitions. However now imagine the situation where you open a file, make some changes, save the file and close it for the day. The next day you come back in and open the file again to continue your work. Now you have to go back to the block of code you were working on and expand it again. If you are in the first camp the "new" behavior is annoying. If you're in the second camp VS2003's behavior was annoying. I personally like the newer behavior but that is just me and is based upon my general programming environment.

I agree that it would have been nice to have an option to either force all opened files to expand/collapse or for VS to remember its previous state. Unfortunately that option doesn't exist. I can't recall seeing the option in VS2008 and given that it is too close to release I'm afraid you will have to live with the existing functionality. I, in general, don't believe in changing functionality without providing an option to retain the original functionality but I wasn't on the VS IDE design team so I can't really help you.

Now for the whole reason for my post. You can get the behavior you want anyway. Outlining takes on various meanings so I can't give you exact details on how to meet your functionality requirements. When opening a file you can press Ctrl+M,O to collapse all outlines. There are other shortcut keys as well. I know, it is annoying but it works. It might not collapse the way you want though. Enter macros. You can use a macro to set up the file exactly the way you want. If you want to collapse all but the currently active block then you can do that through macros. Macros are pretty simple to write so it shouldn't take you too long.

If you want to get really advanced or if you want to automate the whole process such that you can just open a file and it outlines the way you want then you'll have to move up to an add-in. VS add-ins are pretty easy to write if you use the existing wizard. Within your add-in you would hook into the event for when new document windows are opened. You would then programmatically set up the outlining for the window however you wanted. Since it is an add-in and you hooked into an event it would behave just like in VS2003.

Yes, I know you probably don't want to have to write an add-in to get the same functionality. However your options are limited at this point. If you write code for v2 then you can either use VS2005 or VS2008, both of which use the newer behavior. If you want the VS2003 behavior you're going to have to write your own implementation. Perhaps MS can add back in the VS2003 option in v.Next but that is years down the road. Your best option is to put in a Connect (http://connect.microsoft.com) request for it. Still it doesn't help you today which I'm sure is your ultimate goal.

FYI there might be an existing addin that will do what you want. I did a quick search and came up with this but it is for VS2003 (in manual mode). However I think it said something about including source code so you can at least get a head start on it. http://www.brothersoft.com/software_developer/microsoft_.net/outline_saver_13999.html Here's another tool that does work with VS2005 and has some additional features: http://submain.com/ nav=products.smartoutline They cost money but it's quicker than writing it yourself or waiting the X years until v.Next. Hope it helps.

Michael Taylor - 10/19/07

http://p3net.mvps.org