502

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?

Andrew T.
  • 4,701
  • 8
  • 43
  • 62
Sarah Weinberger
  • 15,041
  • 25
  • 83
  • 130
  • 1
    See also http://stackoverflow.com/questions/3436222/how-to-locate-a-file-in-solution-explorer-in-visual-studio-2010 – dyesdyes Feb 25 '14 at 16:23
  • 1
    use "Find in Solution Explorer" extension (http://visualstudiogallery.msdn.microsoft.com/d2fc1e94-b85c-4a15-8569-390db1e04f47) which Adds the "Find in Solution Explorer" menu command to the context menu of open document tabs. – S.Serpooshan Apr 09 '14 at 05:44
  • If you have ReSharper, I posted a context menu solution [here](http://stackoverflow.com/a/32238950/264672) – Shay Aug 27 '15 at 00:50

9 Answers9

846

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.

Ajay2707
  • 5,690
  • 6
  • 40
  • 58
Chris Bowen - MSFT
  • 9,589
  • 1
  • 17
  • 13
  • Awesome! Microsoft should let users know when they turn a feature off. it was much missed yestdrday. Thanks! – Sarah Weinberger Oct 02 '12 at 14:20
  • 25
    Although I checked it, It doesn't work in most cases. I think it is buggy in VS 2012. When the solution explorer is "Auto Hide" mode (or unpinned) , it looses the active file position and moves the top! It is really disgusting :( – Mahmoud Moravej Nov 17 '12 at 05:49
  • 8
    Upvoted! This is on by default in 2010 and I HATE it! Luckily, you can turn it off using the method above in 2010. Thanks! –  Jan 10 '13 at 22:30
  • 2
    @MahmoudMoravej, there is a bug reported regarding that matter https://connect.microsoft.com/VisualStudio/feedback/details/777003/solution-explorer-being-in-the-auto-hide-mode-doesnt-stay-in-sync-with-the-active-item – Trident D'Gao Jan 20 '13 at 13:39
  • Setting doesn't work correctly when the solution explorer is docked as a document either, UNLESS the document is visible in a split or separate window group. – Dan Fitch Apr 16 '13 at 19:50
  • 2
    Welcome to Visual Studio land where the bugs are reported and then never fixed! Seriously, I'm seeing this bug today and it was reported 2 years ago. – jcollum Mar 12 '15 at 15:23
  • 7
    If Visual Studio was perfect then who would buy Resharper? – vezenkov Jul 27 '15 at 14:22
  • 1
    If you've got >200 projects in your solution this one is just nice. – C4d Sep 14 '16 at 14:34
  • 1
    Been looking for an option like this for ages! thanks! – James Hatton Aug 03 '17 at 09:05
  • 1
    This solution applies to VS Pro 2019 Version 16.9.4 as well – ShortM Apr 21 '21 at 06:38
  • 2
    in VS 2022 Tools - > Options - > Projects and Solutions - >General -> Track Active Item in Solution Explorer – Moaad May 12 '22 at 14:32
328

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

Callum Watkins
  • 2,844
  • 4
  • 29
  • 49
Alex Blekhman
  • 3,875
  • 2
  • 19
  • 18
  • 1
    This also works in Visual Studio 2013. Even the Express editions. – Duncan Awerbuck Sep 19 '14 at 07:57
  • 3
    This should be available as an option in the context menu as well! – Vishal Shah Oct 08 '15 at 11:09
  • 7
    I learned from another answer in this thread that there is also an icon along the top of the solution explorer which will "sync with active document." Not sure if this was introduced in 2012 or 2013, but it works in 2013. – Ada Richards Nov 11 '15 at 22:42
  • 1
    In VS2012(not tested in 2013, 2015) one can use either the "Track Active ..." option or the shortcut/icon. Both are not possible. You will get message Keyboard combination is bound to command (SolutionExplorer.SyncWithActiveDocument) which is not currently available. – IvanH Dec 11 '15 at 15:13
  • YMMV, but I find the default key shortcut cumbersome to press, so I mapped this command to the F6 key instead. Works great for me. – Jon Schneider Dec 29 '15 at 16:14
  • 3
    I use VS2015 + ReSharper on Win10 and this is the only way that works now. If you're willing to use a different shortcut, look for "SolutionExplorer.SyncWithActiveDocument" on Keyboard options. – ScottRhee Oct 17 '16 at 05:45
  • I just changed the assignment to be alt + shift + l to match JetBrains Rider – Jared Beach Oct 09 '20 at 19:17
117

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

Ajay2707
  • 5,690
  • 6
  • 40
  • 58
Rob Willis
  • 4,706
  • 2
  • 28
  • 20
  • 20
    @Joe : Sarah did not mention whether she is using ReSharper or not so I would disagree – Eduard Dumitru Nov 01 '13 at 18:39
  • 1
    this should be the correct answer. much more pratical and generic. – hopper Apr 22 '14 at 20:23
  • 11
    It isn't the correct answer if you aren't using resharper. – Don Rolling May 27 '14 at 15:50
  • 10
    @RicardoParro: how can it be *more* generic when it depends on an expensive third party add-on? – Nick Cox Jan 30 '15 at 10:15
  • 2
    The question was about Visual Studio. People who use Resharper basically live in a whole different world, so this answer doesn't answer the question. – Dominic Cronin Jun 21 '16 at 08:25
  • In 2015 at least, you can assign the ReSharper shortcut to that action, even without ReSharper. Tools > Options > Environment > Keyboard > SolutionExplorer.SyncWithActiveDocument – jaycer Oct 05 '16 at 18:07
  • 1
    The advice "Active Item Tracking will also need to be enabled as described in the accepted answer" is wrong! The purpose of shift/alt/L is to highlight the current item in the solution explorer when automatic active item tracking is disabled. If you have Active Item Tracking enabled then you don't need to click shift/alt/L as the current item will be automatically selected. – Adrian W Apr 17 '18 at 15:03
53

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 your Keyboard Settings (Tools->Options->Enviornment->Keyboard)

    In addition there is also a new icon in the Solution Explorer, more about this here.

    Sync with Active Document Button in VS2013 - Solution Explorer

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

Community
  • 1
  • 1
David Leitner
  • 3,312
  • 1
  • 18
  • 27
31

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:

  1. Go to Tools->Options and search for "Keyboard" in the Search Options textbox:

enter image description here

  1. In the Show commands containing box type "solutionexplorer" and then in the list below look for the SyncWithActiveDocument command: enter image description here

  2. Click in textbox under "Press short keys" label and press: Shift+Alt+L and click the Assign button and you are done: enter image description here

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!

Baig
  • 1,489
  • 1
  • 25
  • 41
  • NB: for VS2012 under the Visual C++ 6 scheme, `Shift + Alt + L` is used for Edit.LineCut (cf. [here](https://msdn.microsoft.com/en-us/library/da5kh0wa(v=vs.110).aspx)). – Kyle Kanos Sep 17 '15 at 21:58
31

It is possible in VSS by three ways.

  1. You can click on Active sync icon on Solution Explorer.

VSS Active sync with icon in solution Explorer

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

VSS_Tools_Active_sync

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

Nandha MV
  • 469
  • 4
  • 14
17

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

enter image description here

Trubs
  • 2,829
  • 1
  • 24
  • 33
  • 1
    Previously it was working but now *Sync with Active Document* is not working for me. I disabled and enable it using `Tools -> Options -> Projects and Solutions -> "Track Active Item in Solution Explorer"` – Waqar Apr 15 '16 at 07:03
7

On Visual Studio 2017, the shortcut is: Ctrl+´,S.

enter image description here

Igor
  • 3,573
  • 4
  • 33
  • 55
6

Visual Studio 2019

Tools => Options

enter image description here

Ali Adravi
  • 21,707
  • 9
  • 87
  • 85