The Navigate To feature introduced in Visual Studio 2010 is the single most important feature they added that made it possible for me to work in Visual Studio without proclaiming my longing and desire for Vim at the top of my lungs every 5 minutes.
The shortcut is Ctrl+, (Control Comma). But the shortcut is just the beginning of effectively using this thing.
What it searches
Files, types, members, and variables.
Search string formats
An all lower case search basically does a case-insensitive "contains" search, but it intelligently sorts the results preferring "Starts With" over "Contains". For example, if you search for "ext", you'll find things like Properties named "Extension" or Methods named "Extract" before you'll find Properties named "Text".
But change your search string so that's it's not all lower case, "Ext", and now it does a case sensitive search which would still return "Extension" and "Extract" but not "Text".
Make your search string all upper case, and now it does a PascalCaseAware search! For example, search for "AVE" and it will match AbstractValidatorExtensions because of the PascalCase, and "AutoSave" because of the case insensitive contains match of "ave" in "Save". Unfortunately it returns the contains matches before the pascal case matches, so this can require a lot of pascal case characters before it will return the item you want at the top.
Put spaces between search terms and it basically does an "and" search, but it's position independent. "auto save" will of course match "AutoSave", but so will "save auto"! Lest I mislead you, the matches don't have to be adjacent, "location incident" will match "AddLocationToSomeIncident".
Tips
Suppose you are looking for a file, and you know part of its name and you know its a JavaScript file. Search for "partofname .js". The ".js" will bring .js files to the top of the results.
Suppose you're looking for the Index view of an MVC controller. There are lots of Index views in your website I bet, so searching for just "index" isn't going to get you too far. Try this: "views partofcontrollername index". partofcontrollername just has to be a unique enough subset of the name of the controller to bring that folder to the top. This illustrates that Navigate To isn't just searching the file name, but the entire file path!
If you have more Navigate To tips, I want to hear them! Comment below or twitter at me!
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.