Visual Studio - Automatically refresh class view when changing class

Viewed 15698

I come from a Java background and have spent many years using Eclipse. One feature that I miss when using Visual Studio (2008) is that the class view does not automatically refresh when I change class. In Eclipse it has a (class) 'Outline' window which represents the current class and shows methods/properties etc, this always updates to the class one is using.

The equivalent 'Class View' in VS does not automatically refresh according to the current class I am visiting. I wondered if anyone knew a way to make this happen?

Ideally I'd like the VS view to be as similar to Eclipse as I could get it, but this one feature would be great.

Thanks in advance, Will

14 Answers

After reading kingmaxxx's reply, I went to Tools->Options->Environment->Keyboard and bound Ctrl+Shift+C to View.SynchronizeClassView in Text Editor view. This seems to supplant and supplement the original behavior (View.ClassView), as it will display ClassView if it wasn't visible and focus on the current class.

(Visual Studio 2008)

For Visual Studio 2005

I found a solution that does not update the view automatically, but at least you get a context entry that helps:

http://blogs.msdn.com/ansonh/archive/2005/12/09/502020.aspx

You can also define a shortcut key:

Tools->Options->Environment->Keyboard and see if you can find "View.SynchronizeClassView".


Oh, just for laughs - here is the answer of Microsoft: http://msdn.microsoft.com/en-us/library/2dae8h2s.aspx

...you can select any symbol in the Code Editor and locate it instantly...

After 7 Steps...

"Class View automatically scrolls to the location of the selected symbol in its hierarchy. "

I can't help you with the class view, but maybe you want to give the solution explorer a try? You can synchronize this one via:

tools -> options -> projects and solutions -> general
enable "track active item in solution explorer"

I haven't had time to get this to work yet, but there is code for a VS2003/2005 add-in to auto-sync here (see the post marked "answer").

Incidentally, this question seems to be a duplicate of this one.

For Visual Studio 2017, CodeMaid Spade comes to the rescue quite perfectly.

Codemaid VS Extension

At first, I couldn't find the equivalent to 'Class View'. It's called Spade.

It auto-syncs to the currently open class.

I don't know of any ways to do this but I agree that it would be a nice feature.

You can track items in Solution Explorer though (Options->Project and Solutions->General->Track Active Item in Solution Explorer).

Coming from Eclipse you will miss a lot of such features. What I miss most for navigation is an easy go to type, go to inheritor and so forth. Other features, such as nUnit support are not part of the vanilla Visual Studio, too. Here is a list of Add-Ins that bridge the gap:

But here comes the drawback: They all charge you money (TestDriven.net only for commercial use). However, they all offer free trials.

Tools Menu -> Options

Then, in the "Project And Solutions" area, you can select to track the active item.

With Resharper, ALT+SHIFT+L goes to the current file in Solution Explorer.

Related