Wow—looks like I'm going to keep going on the "lazy" theme that I've started over the past few weeks, when I blogged about the availability of my team's Power Toy Pack Installer and Resource Refactoring tools. Everyone wants to be able to write code more quickly, and we all know that from app to app, you end up using lots of the same code again and again. How you rewrite that code again and again differs from person to person—maybe you save it in a text file on your desktop, or you go back into the old code file and copy and paste it in, or (gasp) you rewrite the code from scratch. You might even know that Visual Studio supports "Code Snippets", and you might even know how to use the ones that are built in (CTRL+K, CTRL+X is the keyboard shortcut), but adding your own snippets—well, that's a slight challenge.
That because in Visual Studio currently, without the aid of an external tool such as Snippy, to edit or create a code snippet, you need to go in and modify an XML file. Charlie Calvert recently wrote a great blog article on how to do this, but let's face it, that's a lot of work for those of us who are just looking at being nice and lazy! J
Well, lazy .NET developers of the world, the Power Toys for Visual Studio team is off to the rescue again—this time with the alpha release of the Microsoft Code Snippet Designer. The Code Snippet Designer is a Visual Studio Integration Package that will integrate right with your installation of Visual Studio (Standard edition or higher) and allow you to create and edit Code Snippets directly from Visual Studio! It's based on the popular Snippy tool, supports replacements and snippet property editing, and even color codes your code based on the programming language you've selected (VB, C#, J#, and XML are all available!)
To start playing with the tool and trying it out for us, download it from MS Downloads here:
Remember, this is an alpha preview release, meaning it has had limited testing, and some stuff just doesn't work yet. Sometimes it doesn't automatically suggest the correct directory to save the new snippet to, and there's currently no way to highlight a section of code that you're working on and automatically export it to a new snippet. Hey though—it's an alpha, and the team wanted to get this in the community's hands sooner rather than later so we can hear from you and get suggestions on what needs to be changed or added to the tool to make it the ideal snippet editing experience.
If you have feedback, just click on the "Send Feedback" button in the Code Snippet Designer. You could even post a comment right here if you're feeling lazy…I'll read it.
Oh, and I'd be remiss to not give props to Matt Manela, the Microsoft intern who created this project this past summer. Matt did a great job on this tool, and I'm excited to work with him as a full-time employee soon. Oh, and Matt, if you want to pick up any of these suggestions or bug reports and get your hands dirty, let me know… J
UPDATE (11/17/06): If you don't have Visual Studio installed in the default location for the English version (c:\Program Files\Microsoft Visual Studio 8\...) the Snippet Designer will fail when launched, saying that it can't find the snippetformat.xsd file (see comments below.) An untested workaround for this would be to search your computer for that file, create the directory on your hard disk: "c:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\1033\" and copy the snippetformat.xsd file into that directory. I just got into work this morning, and haven't had a chance to install Visual Studio in a different location and actually test this yet, so if anybody who's having the problem could try the fix and post back here if it works, it'd be appreciated!