Yaakov Shoham
Yaakov Shoham

Reputation: 10538

Auto select file in Solution Explorer from its open tab

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?

Upvotes: 319

Views: 159946

Answers (14)

Fedearne
Fedearne

Reputation: 7348

Visual Studio 2013, 2015, 2017, 2019 and 2022+

One option is to bind 'View.TrackActivityInSolutionExplorer' to a keyboard short-cut, which is the same as ToolsOptionsProjects and SolutionsTrack 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, 2015, 2017

There is now a feature built in to the Visual Studio 2013 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.

This icon was then subsequently dropped again in VS 2019 and 2022.

Upvotes: 455

Aran Tamool
Aran Tamool

Reputation: 309

In visual studio 2022

Similar to this answer https://stackoverflow.com/a/8473574/13275637

You need to tick Track Active Item in solution Explorer

enter image description here

Upvotes: 12

Baraa Deek
Baraa Deek

Reputation: 171

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

Upvotes: 17

Anwar Ul-haq
Anwar Ul-haq

Reputation: 1881

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

Upvotes: 8

Francesco De Vittori
Francesco De Vittori

Reputation: 9290

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.

Upvotes: 246

Sergey Pashkevich
Sergey Pashkevich

Reputation: 21

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.

Upvotes: 2

Maksym Kozlenko
Maksym Kozlenko

Reputation: 10363

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

Upvotes: 43

friend
friend

Reputation: 1919

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

Upvotes: 9

Basic
Basic

Reputation: 26756

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.

Upvotes: 8

Tarun
Tarun

Reputation: 2958

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

Upvotes: 5

themissinglint
themissinglint

Reputation: 73

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

Upvotes: 3

jpierson
jpierson

Reputation: 17356

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.

Upvotes: 1

AJ.
AJ.

Reputation: 16719

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.

Upvotes: 34

Related Questions