Visual Studio Smart Tag Expansion Tip

code 0 comments suggest edit

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!

Technorati Tags: Tips,Visual Studio,Shortcuts,Keyboard

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.

Comments

avatar

21 responses

  1. Avatar for Keithius
    Keithius June 23rd, 2008

    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!

  2. Avatar for David Fauber
    David Fauber June 23rd, 2008

    Ah, thanks. A friend of mine showed me this last summer but I'd forgotten all about it.

  3. Avatar for nbirkes
    nbirkes June 23rd, 2008

    I learned about ctrl + [space] sometime last year and now I use it constantly! This should come in handy too!!
    Thanks!

  4. Avatar for mark
    mark June 23rd, 2008

    cool, one shortcut i always wonder about is how to auto-populate the list of event handlers in a asp.net control tag.
    ie:
    <asp:button onclick="{auto-populate this}"/>

  5. Avatar for Peter Ritchie
    Peter Ritchie June 23rd, 2008

    Time to subscribe to your colleague's blog:
    blogs.msdn.com/.../414105.aspx

  6. Avatar for Robert G
    Robert G June 23rd, 2008

    It's amazing how little we need for happiness.

  7. Avatar for Jeff Handley
    Jeff Handley June 23rd, 2008

    I had somehow missed this one too, thanks!

  8. Avatar for Ayende Rahien
    Ayende Rahien June 23rd, 2008

    Have you tried ReSharper

  9. Avatar for Dragan Panjkov
    Dragan Panjkov June 23rd, 2008

    This is one excellent shortcut. I use it extensively. You didn't know about it? :)

  10. Avatar for dario-g
    dario-g June 23rd, 2008

    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. :)

  11. Avatar for Jeff Atwood
    Jeff Atwood June 23rd, 2008

    I always map this to ALT+DOWNARROW, which seems wayyyyyyyy more logical to me.
    www.codinghorror.com/blog/archives/000506.html
    Smart Tags rule!

  12. Avatar for Boersnoes
    Boersnoes June 23rd, 2008

    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.

  13. Avatar for Vesta
    Vesta June 23rd, 2008

    i am using devexpress refactor.it puts some dots insted of the box and has more refactoring options

  14. Avatar for AndrewSeven
    AndrewSeven June 23rd, 2008

    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 :)

  15. Avatar for Richard Szalay
    Richard Szalay June 23rd, 2008

    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.

  16. Avatar for haacked
    haacked June 23rd, 2008

    @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.

  17. Avatar for James Curran
    James Curran June 23rd, 2008

    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)

  18. Avatar for haacked
    haacked June 24th, 2008

    @James Nice!

  19. Avatar for Carl
    Carl June 29th, 2008

    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

  20. Avatar for Jeff Schumacher
    Jeff Schumacher July 6th, 2008

    @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.

  21. Avatar for GiUmaTo
    GiUmaTo February 28th, 2011

    FINALLY!!! :)