Auto select file in Solution Explorer from its open tab

Visual StudioVisual Studio-2010

Visual Studio Problem Overview


Normally, many files in Visual Studio 2010 are opened in many tabs, while massively working on a project. Many times, I find myself right-clicking on a tab title and searching for Show/Select/Scroll-to this file in Solution Explorer, and I can't find it.

Is there a way to automatically select an opened file in Solution Explorer?

Visual Studio Solutions


Solution 1 - Visual Studio

Another option is to bind 'View.TrackActivityInSolutionExplorer' to a keyboard short-cut, which is the same as 'Tools-->Options-->Projects and Solutions-->Track Active Item in Solution Explorer'

If you activate the short-cut twice the file is selected in the solution explorer, and the tracking is disabled again.

Visual Studio 2013+

There is now a feature built in to the VS2013 solution explorer called Sync with Active Document. The icon is two arrows in the solution explorer, and has the hotkey Ctrl + [, S to show the current document in the solution explorer. Does not enable the automatic setting mentioned above, and only happens once.

Solution 2 - Visual Studio

I don't know if you can do it on-demand, but you can enable the option "Track Active Item in Solution Explorer" (Tools->Options->Projects and Solutions->General) which will always select the active tab item in the solution explorer.

Solution 3 - Visual Studio

If you're using the ReSharper plugin, you can do that using the Shift + Alt + L shortcut or navigate via menu as shown.

Enter image description here

Solution 4 - Visual Studio

This isn't exactly what you're looking for, but it would automatically select the "active" file in the Solution Explorer:

Tools-->Options-->Projects and Solutions-->Track Active Item in Solution Explorer.

Solution 5 - Visual Studio

The best option now is to install the Microsoft Visual Studio add on called Productivity Power Tools.

With this comes "Solution Navigator" (alternative to Solution Explorer, with a lot of benefits) - which then you can use to filter the files to only show "Open". You can even filter files to show "Edited" and "Unsaved".

Solution 6 - Visual Studio

simply Tools--> Options--> Projects and Solutions--> Track Active Item in Solution Explorer

Solution 7 - Visual Studio

It's in VS2012 - Specifically the 2-Arrow icon at the top of the solution explorer (Left/Right arrows, one above the other). This automatically jumps to the current file.

This icon is only visible if you've got Track Active Item in Solution Explorer disabled.

Solution 8 - Visual Studio

In Visual Studio 2012, the same can be done using the "Sync With Active Document" option in Solution Explorer

Solution 9 - Visual Studio

In VS 2019 select Tools > Options and then tick "Track Active Item in Solution Explorer" enter image description here

Solution 10 - Visual Studio

The Tab Studio plugin adds "select in solution explorer" to the right click menu on tabs.

Solution 11 - Visual Studio

I've put in a feature request for this very feature. Although I know this isn't an answer in itself it is a step in the direction of being able to get this feature implemented. Any votes it it may help to get Microsoft's attention.

As far as I'm aware of though there is no way to do this other than possibly writing a macro or creating your own add-in/extension to Visual Studio.

Solution 12 - Visual Studio

There's a very nice extension to VS2010, which does exactly this: Solution Explorer Tools.

This extension adds a button which selects the current file in the solution explorer, as well as convenient buttons for collapsing and expanding projects.

Solution 13 - Visual Studio

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionYaakov ShohamView Question on Stackoverflow
Solution 1 - Visual StudioFedearneView Answer on Stackoverflow
Solution 2 - Visual StudioFrancesco De VittoriView Answer on Stackoverflow
Solution 3 - Visual StudioMaksym KozlenkoView Answer on Stackoverflow
Solution 4 - Visual StudioAJ.View Answer on Stackoverflow
Solution 5 - Visual StudiofriendView Answer on Stackoverflow
Solution 6 - Visual StudioBaraa DeekView Answer on Stackoverflow
Solution 7 - Visual StudioBasicView Answer on Stackoverflow
Solution 8 - Visual StudioTarunView Answer on Stackoverflow
Solution 9 - Visual StudioAnwar Ul-HaqView Answer on Stackoverflow
Solution 10 - Visual StudiothemissinglintView Answer on Stackoverflow
Solution 11 - Visual StudiojpiersonView Answer on Stackoverflow
Solution 12 - Visual StudioSergey PashkevichView Answer on Stackoverflow
Solution 13 - Visual Studioömer F.View Answer on Stackoverflow