Monday, November 5, 2007

My Latest Favorite Keyboard Shortcut for Visual Studio 2005

So, the Visual Studio 2005 IDE offers a really nice smart tag feature for renaming your variables, constants, methods, etc. Instead of doing Ctrl-H to find and replace (possibly changing more than you planned), you can simply go to the location where the item is defined and type a new name. When you are done, the smart tag for that item becomes active as indicated by a little, red line that appears under the end of the word. You can move your mouse over the red line and the smart tag will expand and give you the option to rename. Selecting this option renames all uses of the item you are changing as opposed to simply changing everything with the same name like replace does. This is a very nice, time-saving feature, and I just recently figured out how to do it without the mouse. Pressing Ctrl-. also makes the smart tag expand with the rename option already highlighted. Then, you can simple press enter. This makes the process a little easier since you don't have to reach for the mouse. If you want to make a custom shortcut (Tools/Options), the command can be found under "keyboard" and is called "View.ShowSmartTag".