Visual Studio Smart Tag Expansion Tip

I used to find the smart tag really annoying in Visual Studio because it is such a small target to hit with the mouse. Silly me, trying to expand a smart tag with a mouse.

VS-smart-tag 

When you highlight the tag with your mouse, it tells you that the keyboard combination of ALT + SHIFT + F10 will expand the menu.

What it doesn’t tell you is that there’s a two key combination that will also expand it. I learned this one from Karen Liu of the C# IDE team who also happens to have a blog post with a nice collection of other tips and tricks written last year.

Just hit the CTRL key plus the period key (CTRL + .)

VS-smart-tag-expansion

I really like this approach when performing renames within Visual Studio because it’s totally contextual. Rather than starting with a rename refactoring, I can instead just start renaming something and the smart tag shows up and all I have to do is hit CTRL + . and then ENTER. Booyah!

What others have said

Requesting Gravatar... Keithius Jun 23, 2008 1:31 PM
# re: Visual Studio Smart Tag Expansion Tip
Wow! That is a really handy tip to know!

I love finding these sorts of new things about Visual Studio - it just gives me such a warm, fuzzy feeling.

Thanks!
Requesting Gravatar... David Fauber Jun 23, 2008 1:39 PM
# re: Visual Studio Smart Tag Expansion Tip
Ah, thanks. A friend of mine showed me this last summer but I'd forgotten all about it.
Requesting Gravatar... nbirkes Jun 23, 2008 2:01 PM
# re: Visual Studio Smart Tag Expansion Tip
I learned about ctrl + [space] sometime last year and now I use it constantly! This should come in handy too!!

Thanks!
Requesting Gravatar... mark Jun 23, 2008 2:16 PM
# re: Visual Studio Smart Tag Expansion Tip
cool, one shortcut i always wonder about is how to auto-populate the list of event handlers in a asp.net control tag.
ie:

Requesting Gravatar... Peter Ritchie Jun 23, 2008 2:16 PM
# re: Visual Studio Smart Tag Expansion Tip
Time to subscribe to your colleague's blog:

blogs.msdn.com/.../414105.aspx
Requesting Gravatar... Robert G Jun 23, 2008 2:17 PM
# re: Visual Studio Smart Tag Expansion Tip
It's amazing how little we need for happiness.
Requesting Gravatar... Jeff Handley Jun 23, 2008 2:19 PM
# re: Visual Studio Smart Tag Expansion Tip
I had somehow missed this one too, thanks!
Requesting Gravatar... Ayende Rahien Jun 23, 2008 2:47 PM
# re: Visual Studio Smart Tag Expansion Tip
Have you tried ReSharper
Requesting Gravatar... Dragan Panjkov Jun 23, 2008 2:48 PM
# re: Visual Studio Smart Tag Expansion Tip
This is one excellent shortcut. I use it extensively. You didn't know about it? :)
Requesting Gravatar... dario-g Jun 23, 2008 3:56 PM
# re: Visual Studio Smart Tag Expansion Tip
When You type like this: "var a = this.Test();" this shortcut will give you also smart tag for generating stub method 'Test'. I'm using it extensively too. :)
Requesting Gravatar... Jeff Atwood Jun 23, 2008 4:12 PM
# re: Visual Studio Smart Tag Expansion Tip
I always map this to ALT+DOWNARROW, which seems wayyyyyyyy more logical to me.

www.codinghorror.com/blog/archives/000506.html

Smart Tags rule!
Requesting Gravatar... Boersnoes Jun 24, 2008 12:29 AM
# re: Visual Studio Smart Tag Expansion Tip
Risking to sound somewhat stuck up: it feels a bit good to finally know something you didn't ;)

The ctrl+. ctrl+space and double tab are the three most used shortcuts for me.
After that f5 and f9 with all their variants.
And as a final the custom mapped "rename", "toggle collapse all" and "run tests in current scope".

Does anybody else here feel that the standard keyboard scheme for VS is rediculous? Shortcuts should not be combinations of keystrokes ([combination1],[combination2]).
If there would be one tool I'm missing in vs it's a descent shortcut mapping tool that doesn't require me to remove a certain shortcut from all conflicting functions before I can assign it to a new one.
Requesting Gravatar... Vesta Jun 24, 2008 4:28 AM
# re: Visual Studio Smart Tag Expansion Tip
i am using devexpress refactor.it puts some dots insted of the box and has more refactoring options
Requesting Gravatar... AndrewSeven Jun 24, 2008 7:15 AM
# re: Visual Studio Smart Tag Expansion Tip
I found ALT + SHIFT + F10 to be far too long, I've been mapping it to [CTRL] + [NUMPAD-0] but I'll be using the [CTRL][.] on other peoples machines now :)
Requesting Gravatar... Richard Szalay Jun 24, 2008 7:57 AM
# re: Visual Studio Smart Tag Expansion Tip
The benefit to using ALT + SHIFT + F10 is that its the default shortcut to expend smart tags in office applications, so you are not remembering two shortcuts that do the same thing.
Requesting Gravatar... haacked Jun 24, 2008 8:47 AM
# re: Visual Studio Smart Tag Expansion Tip
@Ayende of course I've heard of Resharper. I've been a big proponent of it. ;) Last I recall, it didn't have the contextual rename. You had to consciously decide to rename a var. I stopped using it when their C# 3 support lagged behind. Now that 4.0 is out, I need to try it out again.
Requesting Gravatar... James Curran Jun 24, 2008 9:17 AM
# re: Visual Studio Smart Tag Expansion Tip
Of course, there's also the One-Key option -- use the context-menu key (on the bottom right, between the Flag key & the Ctrl key)
Requesting Gravatar... haacked Jun 24, 2008 12:21 PM
# re: Visual Studio Smart Tag Expansion Tip
@James Nice!
Requesting Gravatar... Carl Jun 30, 2008 7:40 AM
# re: Visual Studio Smart Tag Expansion Tip
Cool, I've always used SHIFT+ALT+F10 - didn't know about CTRL+.

I don't think that I'll be able to use it though, I think that changing a shortcut can be more counterproductive.

In the spirit of IDE tips, I find that Sara Ford's blog has shown me a lot of things that I wasn't aware of:

http://blogs.msdn.com/saraford/default.aspx

C
Requesting Gravatar... Jeff Schumacher Jul 07, 2008 9:25 AM
# re: Visual Studio Smart Tag Expansion Tip
@Boersnoes

Check out Code Rush and Refactor Pro! from DevExpress.com. Mark Miller makes the same complaint during his "Mark Miller on CodeRush with Refactor!" screencast on DNRTV (http://www.dnrtv.com/default.aspx?showNum=107) and shows how Code Rush and Refactor can make those annoying VS hotkey combinations much better.

What do you have to say?

(will show your gravatar)
Please add 7 and 3 and type the answer here: