1. Technology

How To Use (And Create) Code Snippets - Part II

Code Snippet Editors


The three editors that are available for download now are:

The VB Snippet Editor is the one that you'll find if you search MSDN for an editor and it's also the one that is referenced in most of the official Microsoft documentation. Both of the others were developed at the Microsoft sponsored site, GotDotNet.com. All were written by volunteers, however, and none are officially "supported" by Microsoft.

The primary goal of all of these editors seems to be to totally insulate you from the source XML for the snippet. There's no way to display it or edit it directly. I call this the "keep 'em dumb and happy" design. In other words, don't let users know what's happening behind the curtain. Web page editors went through a similar phase where the goal seemed to be insulate users from HTML. The best ones now let you edit the HTML directly if you choose to. That capability will have to wait for the next generation of code snippet editors, however.

Let's see how the snippet editors handle our very simple "Hello World" example.

The VB Snippet Editor

In spite of the name, the VB Snippet Editor can be used for C#, J#, and XML code snippets as well. But the programmers who wrote it used VB.NET as their language of choice!

The illustration below shows our Hello World snippet in the VB Snippet Editor.

Click Here to display the illustration
Click the Back button on your browser to return

When this article was written (October 2006), the download was still described as "Release Candidate" and it does seem "unfinished." There's no integrated Help, for example. The install didn't add anything to the programs available from the Windows Start button and it's not listed in Windows Add/Remove Programs. It's just an ".EXE" file that you run. The minimal install reminds me of the "good ol' days" of DOS!

None of the editors had extensive Help systems but the VB Snippet Editor doesn't even have a Help menu. F1 does nothing. There is an eight-page instruction file listed at GotDotNet.com, but the downloaded file has some sort of technical problem so it was unusable when this article was written. So you're pretty much on your own in using the VB Snippet Editor. (If you're reading this article and you discover that they've fixed the problem, let me know so I can update the article.)

I also found the "Test" button to be less useful. The VB Snippet Editor generates "wrapper" code for the snippet, but it's generally not enough to keep unrelated errors from popping up so you end up wondering why a snippet that is actually correct still won't run.

On the plus side, if you want a fast and simple way to create a code snippet, this editor does the job! And there's a handy Export button that saves the code snippet as a ".vsi" (Visual Studio Installer) file. This makes it quick and easy for anyone to add it to their system.


This utility is much like a version of the VB Snippet Editor that has been redesigned to "fit" on a single form - sort of. But this makes the form so long that I couldn't display the whole thing when I reviewed it! I had to do multiple captures just to create the illustration below:

Click Here to display the illustration
Click the Back button on your browser to return

Snippy improves on the VB Snippet Editor by having a Help system, but it only displays a single page of information. I thought it was interesting the VB Snippet Editor lets you specify a Snippet Help system URL and this one doesn't! There's no ability to save a snippet as a .VSI file either.

Changing between languages is nicely done - if you're interested in coding for more than VB.NET. You might wonder why there is a checkbox under Snippet Type when there is only one item: Expansion. Change to one of the other languages and several more items are displayed since the other languages support more Snippet Types than VB.NET does.

The default directory this system installs into is named, "Power Tools for Visual Studio 8" but there's no indication that there will be any companion "Power Tools" to go along with it. I simply moved the whole thing to a more appropriate directory.

Snippy also has a dropdown listbox for the name of the Snippet. This suggests that you can have more than one code snippet in a file and that is consistent with the XML code snippet structure. But Microsoft states that it just doesn't work right now and you should only put one snippet in a file.

Snipp Doggy Dogg

Cute name. The overall design of this editor seems totally superior to the other two. It has a nice "Visual Studio" feel to it with a "property" window and a "folders" hierarchy rather than just giving you a form to fill out. This results in the much more compact, but still easy to use interface shown below.

Click Here to display the illustration
Click the Back button on your browser to return

The version I reviewed seemed to be beta code because some of the features just didn't seem to work. Jason Griffin, the principal author promised that when a "version 1.0" is declared, updates would be included and it would be available at both GotDotNet and CNET Downloads .

Editor Conclusions

Although Snipp Doggy Dogg has the potential to be the best editor, for now I would have to recommend that programmers fall back on the VB Snippet Editor. None of them has the professional polish that you expect in mature software, however. Each seemed to have non-functional features and I ran into the occasional program crash, especially in the VB Snippet Editor.

  1. About.com
  2. Technology
  3. Visual Basic
  4. Using VB.NET
  5. How To Use (And Create) Code Snippets - Part II

©2014 About.com. All rights reserved.