Inspired by my recent post on C# code snippets, I found a little console app by Francesco Balena* that enumerates all the snippets on your system along with their shortcut text.
I improved his console app and turned it into a convenient IDE macro along the lines of my keyboard shortcut enumerating IDE macro:
Download the Snippet List Macro (3kb ZIP)
I found out the hard way that the snippet manager writes all of its changes to the registry. So I use the registry to enumerate all possible snippet paths (this picks up all the per-system snippets and per-user snippets) and also to locate the snippet XML index file that cross-references all the physical paths.
The macro defaults to enumerating the C# snippets, but you can change the _Lang variable to enumerate any available snippet library: VB, C#, J#**, and Xml.
This macro only works in Visual Studio 2005, obviously. Here's how to run it:
- go to Tools - Macros - IDE
- create a new Module named "Snippets" under "MyMacros"
- paste the macro code into the module
- close the macro IDE window
- go to Tools - Macros - Macro Explorer
- A new macro named "List" will be under "Snippets." Double-click it to run.
- The macro will take a minute or so to write a HTML file to your My Documents file, and open that HTML file in the IDE.
* One of my earliest coding heroes!
** Does anyone actually use J#? C'mon. Seriously.