AutoCode 2.0 Beta 1
AutoCode is a simple tool for Visual Studio .NET. Its goal is to enable
you to easily create and use simple code templates. There are two parts
here: a template editor and a runtime replacement engine.
Templates have a pretty straightforward syntax. For example, here's one
for VB .NET to create a public class:
''@ Template language="vb"
/*=blanks*/Public Class <%=args(0)%>
/*=blanks*/ Public Sub New()
/*=blanks*/ End Sub
For the most part, this is just text to be dumped directly into your
code. But there are some other features here as well. The /*=blanks*/
token represents the leading whitespace at the point where the template
is invoked; this makes it easy to maintain indentation. The <%=args(0)%>
token is replaced with the first token on the line where the template is
replaced; as you'd guess from the number, you can pass an arbitrary
number of tokens. The [@] indicates where the cursor should be placed; a
slight extension of this syntax lets you highlight a portion of the
With this template saved under the name cpub, then using it is as simple
and pressing Ctrl+Enter. The expansion is performed, returning the class
with its constructor, and the cursor directly after the constructor.
AutoCode ships with a small selection of templates having to do with
properties, regions, methods, and a few other odds and ends. Hopefully
it will build up a larger library as it moves through the beta process
and into release. It's also very fast; if anything, replacing an
AutoCode template is faster than pressing Ctrl+Space to invoke Visual
Studio's own AutoComplete feature.
There are still a few rough edges here. For one, the template editor is
a separate window, rather than being integrated as a VS .NET tool
window. For another, the template language lacks sufficient escapes; if
you want [@ to appear in the output, for example, you're out of luck.
But as a fast way to inject boilerplate code into your .NET
applications, it's certainly priced right.