Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In Visual Studio 2005, we introduced code snippets. The VS Editor Team Blog has a nice write-up on code snippets, if you want to learn more instead of waiting for a tip here and there from me =)
So we’re going to start the code snippet tip series with how to actually insert a code snippet. The keyboard shortcut is Ctrl+K, Ctrl+X. It is bound to the command Edit.InsertSnippet, in case your mileage varies, depending on your configuration settings.
I’m going to use C# for today’s tip, but this applies to all languages that support code snippets. When I invoke the Edit.InsertSnippet command, the code snippet insertion UI pops up. Did you know… (the real tip here) that the snippet picker allows for type-ahead scrolling. Note how I started typing "#re" on the line. (oh, the fun i had testing this… but i digress…)
Additional keystrokes:
- You can hit tab to auto-complete the word. If the word happens to be the code snippet (and not a folder), pressing tab will insert it.
- You can also hit Shift+Tab to navigate back to the previous word (my contribution to the insertion UI)
Technorati tags: VS2005Tip, VS2008Tip
Comments
Anonymous
December 10, 2007
Hey Now Sara, I learned another little tip. Thx 4 the info, CattoAnonymous
December 18, 2008
本篇包括tip101-tip110http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-11.html#101、块缩...