views:

33

answers:

2

The regular way (typing the shortcut followed by the Tab key) doesn't seem to work. If not, maybe there's some other way of inserting snippets not using the mouse, with as few keystrokes as possible? What language should be specified in the "language" attribute of the "Code" element in the .snippet file? I use VS2010.

A: 

To get the snippet menu you can use CTRL+K, CTRL+X then select the snippet you want. I don't have any problem using shortcut followed by TAB so it could be a change to your settings that is stopping it. As far as language goes the snippet menu shows snippets based on the language of your code file. You may find it useful to use a snippet editor like Snippet Editor if you are creating your own snippets.

Andy Robinson
Thank you for your information. I found out that I was having this problem because I was trying to insert a snippet as a function parameter (to fill out a commonly used lengthy list of AjaxOptions for Ajax.ActionLink()). When I do the same thing outside the function call, it works. It looks like using snippet shortcuts inside a function argument list is not supported.
SlimShaggy
Ok glad you worked it out.
Andy Robinson
A: 

I found out today that pressing TAB twice works OK if I type the snippet shortcut after the new keyword, so I changed the snippet code from "new AjaxOptions {UpdateTargetId = "page", OnFailure = "handleFailure", ... }" to "AjaxOptions {UpdateTargetId = "page", OnFailure = "handleFailure", ... }", and everything seems to work fine now.

SlimShaggy