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:
- Go to Tools->Macros->Macro Explorer.
- In the Macro Explorer tree that comes up, right-click MyMacros, and then New Module....
- Call the new module SyncItem (if you want).
- Right-click the new module, then Edit.
- Paste this into the code window. (I don't know or care if the Imports lines are necessary; they're just there by default.)
code:
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module SyncItem
Sub SyncSolutionExplorer()
DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
End Sub
End Module
The macro is most useful if you bind it to a keystroke. Here's how to do that:
- Go to Tools->Options, then select Environment->Keyboard.
- Find the new macro in the list (start typing "syncitem" or similar in the search box).
- I choose Alt-Shift-T (which this dialog box likes to call Shift-Alt-T) for, um, "Tree," I guess? If you're a fan of
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.