Tuesday, November 11, 2008
Navigating in Visual Studio
I work with Solutions that contain hundreds of files. Navigating through many levels of directories can be a cumbersome task, especially when you are not the author of the Solution. In university, using Visual Studio for assignments was never a problem, since you get to architect the structure of the Solution.
Working with a larger Solution, I was constantly performing Searches on desired keywords. This worked, but very time consuming. I needed to speed things up to increase my productivity. I wanted a mechanism to remember where sections of code are located within the Solution. Here are a couple of tips that can help:
Tip #1: Using Bookmarks
Visual Studio has a Bookmarks feature that allows you to save a specific line in a specific file. They work exactly like bookmarks used in web browsers. Simply press Ctl+k and Ctl+k to save the line as a bookmark. Note that you need to do Ctl+k twice, as I presume Visual Studio is starting to run out of shortcut keys! Once the bookmark has been saved, you can view the bookmark in the Bookmarks window that can be docked at the bottom of your window:
Instead of using the filename as the Bookmark title, try placing a comment as the title instead to remind yourself the importance of the said file, or even a "TODO" comment. I have a handful of bookmarks for files I have edited so I can quickly re-visit the file if need be.
Tip #2: Track item in Solution Explorer
Another tip to help navigate Visual Studio is to enable "Track Active Item in Solution Explorer". This allows any active file to be highlighted in the Solution Explorer. This comes in very handy when performing Searches, since double clicking a result highlights the file in Solution Explorer, giving you a general idea of the location of the file within the Solution.
This option can be enabled through Tools -> Options -> Projects and Solutions.
This behaviour is actually enabled by default, but for whatever reason, this feature was disabled one day. I went through days without this feature, so I finally made the effort to scan the long list of options under the Options dialog, and it was worth it!
Labels: Visual Studio
Subscribe to Posts [Atom]
