In this series of post I plan to share usefull features of Visual Studio 2010. In this first part the focus is on how to avigate your code.
Quickly find and open files
Have you ever tried to find a specific file in the Solution Explorer in a large project you certianly have come across the limitation of the soltion explorer. Sometimes it's like finding a needle in the haystack and I would hope you have better things to spend your time on than that.
Use the command window
If you do have the command window open you can simply type "of [start of file name]" like this:
Notice the autocompletion. Just select one of the rows and press enter and the file will be opened. NOTE: instead of "of" you can also use "open"
Use the Find box
How often do you have the command window sitting around? I don't atleast. For me there is a much better option. In the toolbars there is the Find box and by adding a > at the start you can use the same commands as in the command window.
Now that is much better!
Use the "navigate to" window
On of the new things in VS2010 was that the added the Navigate To window. Press "ctrl + ," and the window opens. One of the nice things with this window is that it is not restricted to file names. It does find functions, properties, classes, fields, enum values and contants too. And you can also search by just typing the Capital letters in the name.
## Intellisense improvements
In VS2010 there where two improvements to the intellisense I barely can imagine not having anymore. Like in the search in the Navigate To window you can now search on any part of the name and not only the beggining and you can also search on the capital letters which is a huge timesaver in some case. For example when doing MVC development MvcHtmlString is much easier to find by just typing MHS
Navigate forward and backward
I recently dicovered a feature in VS that lets you jump back and forth between positions in the document or in different documents for that matter. Located in the View menu there are two command named Navigate Backward and Navigate Forward.
What these commands do is that they bring you to the previous or next postion you had the carret on. As you can see there are shortcut keys for this. Personally I have a keyboard from Microsoft(Natural Ergonomic Keyboard 4000) that allows me the to bind a combination of keystrokes to certain buttons so I did bind those commands to the backward and forward buttons which are placed just below the spacebar. Really neat!
Find out who called you, Find all references
Sometimes you are interested in finding code that calls the method you are currently in. In VS2010 they added the View Call hierarchy command but unfortuanly it seems like that only displays calls to the implementation. If most calls are to an interface you are out of luck. Luckily there is Find All References(Right click the method and look in the context menu) Which displays a list where calls to the interface is displayed.
Right click on any of the results and you can move there.
Do you got any navigation tips?
I hope there was some new things for you to learn in this post that allows you to quicker and happier developer.
If you have any tips and tricks that does help you to be more efficient navigating Visual Studio please share them with the rest of us.