New T4 Template Visual Studio Editor.

During this past month I've been working in a new T4 template editor as a part of the SFT.

If you're working with dsl or gax you already know, how the editor looks when you try to edit a text template file, it looks like this:

image

So now you can have a fully colorized text editor for your T4 templates like the ASP.NET Vs editor and you can get it now downlaoding the ClariuS Software Factories Toolkit here.

Colorizing, Intellisense and Validation

In this release it's providing colorizing and intellisense for the T4 statements, like directives, class features and blocks. Regarding the directives you have intellisense for all well known directives and its properties and values.


t4editor

One interesting feature is for those the well known properties which represents a type, the intellisense gives a complete list of the current project types including its references.

t4editorintellisense00

Validation

Like the ASP.NET editor you have a real time document validation.

Validation

 

Preview Transformation

One useful feature is the possibility to run a template transformation in design time, basically as you know, there are two common contexts to run t4 templates, that's a DSLTools Host and GAX Host. When you use the GAX host, most probably you use properties, so you can specify those properties values through the editor property window.

t4editorproperties

If you want to use complex types you can specify in the property declaration an UITypeEditor and a TypeConverter if it's needed.

t4typeeditor

So to run the transformation you just have to specify some values for the properties and run the preview transformation commands, which is located at top of solution explorer or in the editor context menu. After running the transformation you get a temp file with the output. If you've specified the ouput extension directive the temp file will have that extension, that's useful so that so to instantiate the proper Vs editor for that output file.

The transformation could fail for different reasons, if the transformation fails when the template is compiled you'll get those errors into visual studio error list, however if the transformation fails after the compilation and when the template is running you'll get the errors in a temp output file.

Debugging

Unfortunately, in this version the editor does not have debug yet, however in the meantime you can check the Garethj's Blog, there he has a post of how you can debug a template. I hope we could include this feature on future versions.

What's coming

We're working in one important feature which is supporting intellisense and colorizing for the embedded language like you already have in the ASP.NET editor.


You can try it now, download the Clarius Software Factories Toolkit from here.

Enjoy.

No Comments