The Talented Mr. Edit.GoToFindCombo

Posted September 11th @ 5:30 pm by aaron

In the movie The Talented Mr. Ripley, Matt Damon plays Tom Ripley, “a young underachiever”. Ripley is gifted at improvisation and impersonation, but he takes an obsession too far.

Apparently our Visual Studio friend the “Go To Find Combo” (weird name, I know–from this point on I’m just going to call the dang thing the “Find” combo) is like Mr. Ripley–adaptive, talented, and full of secrets. If you don’t recognize it by name, the “Go To Find Combo” is the “Find” combo box in the Standard toolbar. (Shortcut: CTRL+/ or CTRL+D, depending on who you believe.)
Visual Studio Go To Find Combo

In the recent Mastering .NET Debugging class I took, John Robbins clued us in to some of the crazy stuff this combo can do. I’m sure under the covers in the key processing code for this dialog there’s a huge “if/else if/else” statement. Just kidding.

Find

Okay, this is what we all know it does. Type in a search term, press enter, and it searches within the current document. Or press the “Find in Files” button (image) and it will display the Find in Files dialog with your search term pre-populated. It probably does so much more relating to searching, but that’s primarily how I use it.

Open A File By Name

Type the name of a file into the “Find” combo, then press CTRL+SHIFT+G (”Open File”), it will find and open the file you specified.
image
(Imagine me pressing CTRL+SHIFT+G in the screen shot above)

Create a New File By Name

Similar to opening a file, create a new file by typing a file name into the “Find” combo and pressing CTRL+N (”New File”). A new file with the specified name will be opened, but it’ll be up to you to save it to the correct place.

Set Breakpoints Instantly

Probably the coolest “hidden feature”, type the name of a Method into the “Find” combo and press F9. Notice that a breakpoint was automatically set on the opening brace of the method! And, if you’ve got overloads, notice that a breakpoint was set on every overload. For example, let’s say I have a “Show” method that has 3 overloads. Typing “Show” and pressing F9 sets these breakpoints:

image

But check out just how talented Edit.GoToFindCombo really is… using my example above, I’m going to type in “Show(Control)” and press F9 to set a breakpoint specifically on the Show(Control control) method. What happens?

 image

It sets a breakpoint on both the Show(IWin32Window) and Show(Control) overloads. Why? Because the Control class implements the IWin32Window interface! So my “search term” for the breakpoint matched two possible overloads, and it was smart enough to know that. Great stuff.

Commands

Anything you can type into the command window you can also type into the Find combo. Just prefix it with “>” and intellisense will guide you. For example, to open a file, type “>open ” plus the first letter of a file. Or you can execute macros, etc. The sky is the limit!

image
Execute a command window command

image 
Execute a macro, custom or otherwise

Update: Sara Ford shows us one more useful feature. Type in a line number and press CTRL+G to jump to the line. Is there no end to the madness?? :)

5 Trackbacks/Pingbacks

  1. Pingback: Stupid Visual Studio Trick, Part 3 « Just Sayin’ More Words on September 11, 2007
  2. Pingback: Quickly Find/Open a File in Visual Studio » Alteridem Consulting on September 12, 2007
  3. Pingback: .Net Adventures : Interesting articles (September 15) on September 15, 2007
  4. Pingback: Opening a VS item's directory in Explorer - dave^2=-1 on February 1, 2008
  5. Pingback: Opening files from the VS "Quick find combo" - Wes' Puzzling Blog on March 27, 2008

4 Comments

  1. John Sheehan
    September 11, 2007 at 21:37

    >of does the same as >open. Are these commands documented anywhere?

  2. aaron
    September 11, 2007 at 22:20

    Yep, they’re documented here:
    http://msdn2.microsoft.com/en-us/library/c3a0kd3x(VS.80).aspx

    And, here’s a good tip from that page:
    “Type >alias in the Command window to display a list of the current aliases and their definitions. Type >cls to clear the contents of the Command window.”

  3. Rob Prouse
    September 12, 2007 at 09:02

    Great post. It is much more informative that the one I posted at http://www.alteridem.net/2007/09/11/quickly-findopen-a-file-in-visual-studio/, so I made an update and linked back to this one.

  4. Danie
    March 27, 2008 at 02:39

    For some reason the “Find” is not in the Standard Toolbar. Any Ideas?

Leave a comment

OpenID Login

Standard Login

Options:

Size

Colors