Freigeben über


Did you know... How to browse code snippets and add new ones - #106

All code snippets are found in the Code Snippet Manager.  It is found at Tools – Code Snippet Manager.   If you are using the default general settings, you can use Ctrl+K, Ctrl+B to bring up the dialog box. 

IMO, the most useful aspect of this dialog is to browse through your current snippets to learn what the "shortcuts" are to quickly insert the snippet into the editor (yesterday’s tip).

Additionally, this is where you add (a directory of snippets) and import (a single or multiple-selected snippets to a specified folder via the Import Code Snippet Dialog).

Code Snippet Manager display the C# "for" snippet

I circled the Language combo box to mention that you should always check there to see what type of snippets you are browsing.  The Code Snippet Manager Language combo box is a MRU, meaning that the last set of snippets you looked at (let’s say XML) will come up the next time you bring up the dialog.  For me as a tester, it was critical that i always confirmed where i was at before using the dialog.  So maybe I don’t need to give out this warning, but old habits die hard, even after a couple of years.

Technorati tags: VS2005Tip, VS2008Tip

Comments

  • Anonymous
    December 13, 2007
    Hi, The menu option for Code Snippet Manager is missing on my machine. I'm running VSTS 2008 test edition. I found this forum post that says the menu disappears sometimes and use Tools>Customize>Commands to add to a command bar: http://www.msdner.com/dev-archive/46/5-20-468786.shtm

  • Anonymous
    December 13, 2007
    Sara, Keep the great tips coming.  By the way, I plan on updating www.GotCodeSnippets.net with VS2008 options soon.  Cheers! Michael

  • Anonymous
    December 28, 2007
    Is there a way to add directories for additional languages? I'd like to add snippets for javascript, html, etc.

  • Anonymous
    March 24, 2009
    Список всех шаблонов можно найти в Code Snippet Manager (Диспетчер фрагментов кода). Чтобы открыть этот