views:

2010

answers:

11

Hi,

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

A: 

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

David Kemp
It works only for Resharper so I don't consider this to be an answer although it works with my visual studio + resharper 4.1
Sung Meister
A: 

Tools Menu -> Options

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

David Kemp
Verified on Visual Studio 2008 (w/ Resharper 4.1)
Sung Meister
This works for Solution Explorer, but not Class View, which is what the OP is looking for.
fatcat1111
A: 

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).

Jakob Christensen
+3  A: 

Hello,

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"

Christoph

tanascius
A: 

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.

olli
IIRC you can /go to type/ with shift-F12.
fatcat1111
+5  A: 

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. "

kingmaxxx
I don't think this works in VS2010 (RC) anymore :(
Martin Aatmaa
For clarification, the View.SynchronizeClassView keyboard shortcut DOES work with VS2010 RC.
Jaxidian
A: 

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.

fakeleft
A: 

based on kingmaxxx's response I found that you can add a button to your toolbar to do the same:

Tools|Customize -> Commands[tab] -> View[Categories]

Grab the Synchronize Class View button and drag it to one of your toolbars.

+1  A: 

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)

Sam Chase
A: 

Sam Chase's answer also works in VS 2010 RC.

Ralph
A: 

The problem with View.SynchronizeClassView is that is doesn't work when a class is being viewed from a virtual folder.

Nicholas