Productivity tip: Visual Studio Smart Tags

In Visual Studio 2005 they added a feature that is very useful – when you type the name of a class, if you have the assembly for that class referenced but you don’t yet have a using tag in your file, it can add it for you. This is accomplished using a Smart Tag (much like the smart tags in Microsoft Office). The one problem is that if you are typing and the smart tag comes up, you have to use the mouse to click on it and choosing an option.

When you first type the word (which is case sensitive)

SmartTag01

Then you put your mouse over the little blip and you get:

SmartTag02

Then you click and you get the menu:

SmartTag03

My point is that this is all a very disruptive if you just want to quickly add the using tag and keep moving. I should mention, that there is a default keyboard binding to show the smart tag menu which is Alt+Shift+F10. Personally I can never remember this short cut.

So what is the tip already?

What I like to do is to bind this shortcut to a more intuitive Alt+Down Arrow. This way I just hold down the alt button and pressing down makes sense that the menu would show.

To set this binding you must open up the Tools->Options menu in Visual Studio and go to the ‘Keyboard’ tab. In the commands box, type in ‘View.ShowSmartTag’ and you will see the command show up in the list:

Then, put your cursor in the Shortcut key box and press Alt+The Down Arrow. Click assign and OK and you are all good to go.

Now to add a using statement, you just have to type the class name, type Alt+Down Arrow, and press enter. Not very disruptive at all. This may seem small but I find this to be extremely useful in my day to day development.

Advertisements

One Response to Productivity tip: Visual Studio Smart Tags

  1. Akhil says:

    This was very useful for me

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: