Kevin Dente's Blog

The Blip in the Noise
Locating the active item in Solution Explorer

Scott Hanselman tweeted a link to Daniel Cazzulino's blog post about automatically synchronizing the Visual Studio Solution Explorer with the active item open in the editor. It's a great tip, but I personally have never been a fan of the Track Active Item option - I find that it slows down the IDE, causes distracting visuals, and often just isn't the behavior I want. I do, however, often want a way to manually sync up the Solution Explorer with my currently open item.

Fortunately, it's very easy to accomplish this with a very simple macro. The idea is very simple - just turn on the Track Active Item option that Daniel mentions, and turn it off again. It's a two-liner:

Sub SyncSolutionExplorer()
   DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
   DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
End Sub

You can wire up that macro to a toolbar button and/or a keyboard hotkey, and (as ScottHa would say) bam, you're golden.

 

Published Wednesday, April 30, 2008 3:12 PM by kevindente

Filed under:

Comments

# re: Locating the active item in Solution Explorer@ Wednesday, April 30, 2008 6:25 PM

There appears to be an error in your blog. I see what seems to be a "new update", so I suspect that spambots have somehow infiltrated the system.

Jeff Atwood

# re: Locating the active item in Solution Explorer@ Wednesday, April 30, 2008 6:29 PM

Sorry, sir, I won't let it happen again. ;)

kevindente

# re: Locating the active item in Solution Explorer@ Thursday, May 01, 2008 7:13 PM

Who are you on twitter?

Send me a tweet at JohnB

JohnB

Leave a Comment

(required) 
(required) 
(optional)
(required)