Solution Explorer Tools (When to Sync to Current File) – Extension #11

Control when Solution Explorer syncs to the current file

I’ve given many talks on Visual Studio, and one of the most popular questions is about controlling when Solution Explorer syncs to the current item. This extension is the best one I’ve seen in providing this functionality.

To Install

You can find the Solution Explorer Tools extension at https://visualstudiogallery.msdn.microsoft.com/en-us/ef4ac3e9-d056-4383-8ca2-11721bd879b4

To Use

First, you must disable the “Track Active Item in Solution Explorer” in Tools – Options – Projects and Solutions – General page.

Track Active Item in Solution Explorer option disabled

Now the fun can begin.

On the Solution Explorer, you’ll see 3 new icons.

New commands on Solution Explorer

Starting right from left:

  1. Sync Item – sync’s the Solution Explorer to whatever document is open (or the last active item if a tool window is in the file tab channel).
  2. Collapse All – recursively collapses everything in the solution explorer
  3. Collapse to Item – this combines the previous commands. This will sync to the currently opened item and collapse everything else.

You can also bind keyboard shortcuts to each of these commands via the Tools – Options – Keyboard page:

  • Project.SyncItem
  • Project.CollapseItem
  • Project.CollapseToItem

Some keyboard shortcut suggestions are to bind Project.CollapseToItem to Ctrl+Alt+semicolon, since it is right next to the Ctrl+Alt+L keystroke that opens the Solution Explorer. If you really like this feature and want it on all the time, you could bind it to Ctrl+Alt+L, overriding the standard Open Solution Explorer commands, so the Solution Explorer will always open and collapse to the current item.

Just double-check what your keyboard shortcuts are bound to, as your settings may be different than mine.

More information

Check out the extension’s gallery page at https://tinyurl.com/solexp

Comments

  • Anonymous
    September 15, 2010
    Nice, but these functions are also included in the VSCommands 2010 extension.  Okay, except for the ability to map commands to the keyboard which is a nice feature.  I'm quickly approaching extension overload trying to learn/remember all the tweaks and keep track of what feature came with which extension... :)  Thanks!

  • Anonymous
    September 16, 2010
    @tobykraft thanks for the feedback. I'm open to any suggestions to improve the series. I had to include this one because i've had people ask me for this functionality to sync to the current item. I promise this series will not be the Solution Explorer extension series =D I'm working on some other extensions, but the IDE is a hobby of mine.

  • Anonymous
    September 17, 2010
    @tobykraft, you can stil do keyboard mappings with VSCommands. Just go to Tools -- Options -- Keyboard and type vscommands in 'Show commands containing'.