In Visual Studio 2005, whenever I would view a file in the main editor, the Solution Explorer would find and highlight that file. Some time ago, this stopped working and the Solution Explorer would do nothing.
This has become quite a pain since following a chain of "Go To Definition"s can lead you all over your solution. Where is the setting to turn this back on?
I just discovered that ReSharper can do what Owen suggests. I have disabled the "Track active item in Solution Explorer"-setting, and when I'm working in a source-file I press Shift + Alt + L and the file is selected in the Solution Explorer. I haven't changed the binding, so I guess that is the default. The upside to this is that you don't have to create a macro and then bind it to a keystroke (although not very difficult, it still has to be done). The downside is that ReSharper isn't free, so it's probably not a solution for everybody.
Tools -> Options -> Environment -> Keyboard
Assign the command
View.TrackActivityinSolutionExplorer
(I use Alt+L)
then to use always hit Alt+L followed by Alt+L
which turns on the feature and locates the file in the source tree and then turns it off again to stop the location bouncing around when you do not want it to.
I like to keep this option turned off (especially when working with a big project), but it's useful to be able to find the file in the tree now and then. I found a way to do this here.
I hope I'm not being too verbose here, but here's the guide to making this work that I wrote for my work's wiki:
code:
The macro is most useful if you bind it to a keystroke. Here's how to do that:
Edit.LineTranspose
, whatever that is (I think it swaps the current line with the following one), then you might like to pick a different shortcut.Tools->Options->Project and Solutions->General
Check the box "Track Active Item in Solution Explorer"
Click on the Tools → Options menu. Select the Projects and Solutions → General option page.
Make sure "Track active item in Solution Explorer" is checked. That should do it.