A: 

The Visual Studio IDE does this already, but with a different visualization - you can expand and contract nested blocks by clicking the +/- buttons on the left margin.

Daniel Earwicker
Ehh...I'm not a huge fan of code folding.
EBGreen
Yes, but those don't give any clue as to the type of structure (whether it's an if statement, a class defintition, a catch block, etc..
Eclipse
@EBGreen - agreed. In my experience code folding allows people to write obscenely large methods and then just hide it in a fold to hide the code smell. I've encountered folds that were over 1K lines long, next to several other 1K line folds in the same method.
Matt
+5  A: 
CMS
Having the line that connects the indentation level helps too.
EBGreen
Especially since the lines are colorized based on the structure they represent.
Eclipse
I can has eclipse plugin?
Chris Nava
implementing this sort of color scheme would be fairly trivial in Vim, I would think...
rmeador
Nice...now do it. I'm too lazy.
EBGreen
NB: It uses outlines instead of background coloring because of VS's limitations.CMS: The correct name is "Codekana".rmeadoe: A basic version of this is non-trivial. An advanced version is highly non-trivial.Chris Nava: I implemented it for VS, doing it for Eclipse must be hell.
jonbho
@jonb, Thanks for the name correction, I haven't noticed!
CMS
cms - no problem at all. glad it's fixed now!!
jonbho
A: 

A nice idea. Personally, I really don't like folding editors, but this would be quite tolerable - you'd want to be able to toggle it on/off easily though. Perhaps someone has already done this for the hyper-programmable editors like vim and emacs?

anon
I think I saw an emacs implementation on SO a few months ago...
dmckee
A: 

I think Xcode 3 does roughly what you want, especially with Focus Follows Selection enabled. Individual blocks are highlighted as you hover over them in the sidebar.

Sören Kuklau
Using an Apple tool to develop C# sounds...ummm...special...
EBGreen
The question mentions C#, but also C++, and doesn't really seem to focus on any language at all.
Sören Kuklau
You are correct, but with the C# and Visual Studio tag I would say that MS focus is likely.
EBGreen
A: 

Existing SO question with some emacs implementations for lisp:

http://stackoverflow.com/questions/318785/emacs-mode-that-highlight-lisp-forms

dmckee
That's not bad, but it all seems to be about highlighting based on nesting depth and not the type of structure. Depth I get already based on indendation.
Eclipse
+6  A: 
Sam Saffron
+10  A: 

I'm the author of Codekana. Indeed, what you describe above was the main goal for the product. BTW, I'm about to publish an article about the "making of" and the underlying technology, which is pretty nifty. It will probably be available next week (March 26, '09 or so). Recommended reading, if I may say so myself.

The reason Codekana only provides outlines, instead of a colored background, are limitations in VS's text rendering extensibility. I will hopefully be able to implement a solid-background version at some point in the future, although it will definitely require serious hacking and "rocket surgery".

I would have commented above, instead of providing another answer, but my reputation doesn't allow commenting. :(

[UPDATE: Thanks for the upvotes, now I can comment!]

jonbho
I'm looking forward to your write-up. I'm playing around with the demo right now, and it's looking pretty good.
Eclipse
Josh: Thanks! Let me know if anything acts up, via the support form, I'll get back in touch via email. Or on Twitter, I recently joined (jonbho).
jonbho
A: 

You should try this Addin and you will never work in visual studio without it, http://www.jetbrains.com/resharper/features/index.html

PS: I'm not affiliated with this company or product but I'm an addict using it and I can never work without it, it saves me alot of time in my coding tasks and code exploration and debugging.

Code Guru