The Talented Mr. Edit.GoToFindCombo
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.)
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.
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 () 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
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:
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?
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.
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!
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?? 🙂