Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Snippet Editor for Visual Studio 2005/2008

Snippet Editor for Visual Studio 2005/2008

Snippets are code templates that can be quickly accessed from the keyboard. They are not code generators per se, but rather just short cuts for common coding patterns. They support linked fields, so altering a variable name in one place will cause it to be altered throughout the snippet. The snippet will also automatically add any project references or import statements needed.

In addition to being a productivity aid, snippets serve as a training tool in Visual Basic. Snippets include instructions for tasks ranging from creating a property or new exception type through esoteric tasks like dialing a phone number using a modem connected to a serial port. To see a complete list of code snippets in VB, type ? then press tab. (It should be noted that C# also supports code snippets, but the built-in catalog is very limited.)

With the Snippet Editor, new code snippets can be created and existing ones edited to match the tasks and coding styles of each team. The snippets can then be sent as single files or packaged in a VSI. Currently there is no support for creating a shared repository for teams, but the possibility is there.

The snippet editor was originally released on GotDotNet. For reasons that are still not understood, Microsoft effectively deleted all of the content that was on the GotDotNet site when it was decommissioned. While some code was moved to CodePlex, the source for the Snippet Editor was not.

Bill McCarthy has recently brought back the snippet editor, source code and all, and added support for Visual Studio 2008. Express editions are also included for both versions.

Rate this Article