VS2010 had the feature that viewing a file would automatically cause Solution Explorer to scroll to that file.
With VS2012, viewing different files from within the IDE no longer scrolls and select the file in Solution Explorer automatically.
Is it possible to get this feature back? Is there a setting somewhere? If so, how/where?
Yes, you can find that under
Tools - > Options - > Projects and Solutions - > Track Active Item in Solution Explorer
It's off by default (as you've noticed), but once it's on, Solution Explorer will expand folders and highlight the current document as you switch between files.
If you need one-off sync with the solution pane, then there is new command "Sync with Active Document" (default shortcut: Ctrl+[, S). Explained here: Visual Studio 2012 New Features: Solution Explorer
If you have ReSharper installed clicking Shift+Alt+L will move focus to the current file in Solution Explorer.
Active Item Tracking will also need to be enabled as described in the accepted answer
Tools->Options->Projects and Solutions->Track Active Item in Solution Explorer
There are many ways to do this:
Go to current File once:
Visual Studio 2013
VS 13 has it's own shortcut to do this: Ctrl+\, S (Press Ctrl + \, Release both keys, Press the S key)
You can edit this default shortcut, if you are searching for
SolutionExplorer.SyncWithActiveDocument
in yourKeyboard Settings
(Tools->Options->Enviornment->Keyboard)In addition there is also a new icon in the Solution Explorer, more about this here.
Visual Studio 2012
If you use VS 2012, there is a great plugin to add this new functionality from VS2013 to VS2012: . The default shortcut is strg + alt + ü. I think this one is the best, as navigating to the solution explorer is mapped to strg + ü.
Resharper
If you use Resharper try Shift+Alt+L
This is a nice mapping as you can use Strg+Alt+L for navigating to the solution explorer
Track current file all the time:
Visual Studio >= 2012:
If you like to track your current file in the solution explorer all the time, you can use the solution from the accepted answer (Tools->Options->Projects and Solutions->Track Active Item in Solution Explorer), but I think this can get very annoying in large projects.
If you don't have ReSharper installed and still want to use the shortcut Shift
+Alt
+L
to move focus to the current file in Solution Explorer in Visual Studio 2013 then please follow these steps:
- Go to Tools->Options and search for "Keyboard" in the Search Options textbox:
In the Show commands containing box type "solutionexplorer" and then in the list below look for the SyncWithActiveDocument command:
Click in textbox under "Press short keys" label and press:
Shift
+Alt
+L
and click the Assign button and you are done:
To verify open any file in Visual Studio and press the shortcut keys Shift
+Alt
+L
and you'll see the file in the solution explorer. Enjoy!
It is possible in VSS by three ways.
- You can click on
Active sync
icon on Solution Explorer.
- By selecting Active sync checkbox in Tools (Tools > Options > Projects and Solutions > General). In that check the Track Active Item in Solution Explorer Checkbox. When you select a file in the main window, it will automatically navigate to active file in the Explorer.
- By using the Shortcut key (
Ctrl
+[
+S
), you can able to navigate to active Item.
Note: Either 1 or 2 only works in a mean time.. So You have to use either 1st or 2nd.
I've found the Sync with Active Document
button in the solution explorer to be the the most effective (this may be a vs2013 feature!)
来源:https://stackoverflow.com/questions/12682656/vs-2012-scroll-solution-explorer-to-current-file