Back to basics: Navigating code with Visual Studio 2013

Posted: (EET/GMT+2)

 

Efficient code navigation within Visual Studio is one important part of developer productivity. I usually try to work with the keyboard, despite the need to memorize dozens of different keyboard shortcuts. But, if you use them day to day, you'll get accustomed to them.

Now, this blog post is about a couple of very strategies to navigate better and faster along your code files and routines within. With a couple of keyboard shortcuts and usage of simple features in Visual Studio, you can become a more efficient developer. Using these tips doesn't require you to install or purchase anything extra.

First, the Navigate To command (Ctrl+comma) which was enhanced in Visual Studio 2013. By pressing this keyboard shortcut, you can write a couple of letters from the filename, class name or method name you are looking for. This, together with the new Peek Definition command (Alt+F12) is highly useful.

Now, once you've navigate to somewhere, you need a fast way to get back to the place where you were. For this, you can use the Navigate Backwards command (Ctrl+hyphen or Ctrl+minus). If, on the other hand, you went to a different file, you can also use the Ctrl+Tab key combination to get back to the previous file that was active.

In addition to transient navigational features like these, I'm myself using breakpoints as navigational aids pretty often – these survive restarting of Visual Studio. Simply set a breakpoint to a code location you want to memorize, and then make sure you have the breakpoints window (pane) visible somewhere. This way, you can easily jump to different locations inside your project, no matter how may files you already have open.

Finally, remember that you can view multiple files at a time in the code editor, and that you can view two locations of a file at the same time by splitting the editor screen into two parts. This is done from the top of the vertical scroll bar, where there's a small horizontal bar, activatable with the mouse.

Do you have a tip you want to share? Send me an email!