T4 Editor by Tangible Engineering
Download T4 Editor now
Although Visual Studio 2008 includes T4, a fully-featured, template-based code generation engine, its support for editing of the code generation templates is very limited. Out of the box, code generation files appear and behave as regular text files in the Visual Studio editor. Not only does this means that you don’t have IntelliSense we have come to take for granted in the last 10 years, you also don’t have the color syntax highlighting which became a standard feature in IDEs 20 years ago. The lack of color syntax highlighting makes working with code generation templates particularly difficult because code blocks and text blocks blend together and make it hard to distinguish code that will be executed during code generation from the code that will be generated.
In order to take full advantage of the productivity offered by T4 and template-based code generation, you really need to have a modern design-time support in your IDE. Enter the T4 Editor by Tangible Engineering.
T4 Editor Features
Tangible T4 Editor extends the Visual Studio editor to provide color syntax highlighting and IntelliSense for T4 code generation files. There are too many features to describe in a blog post, but here are some of my favorites.
Color syntax highlighting
The color palette is very close to ASP.NET. A nice improvement is a subtle yellow background for code blocks that helps you distinguish template code from the generated code. You get colors in both code blocks (based on the language specified in template directive) and text blocks (based on extension specified in output directive).
IntelliPrompt for T4 directives and code blocks
As soon as you type <, the editor displays a list of T4 directives and code blocks, helping you type them. If you select or type <#@, the editor will display a list of standard T4 directives. Once you select the directive, the editor displays prompts for each parameter, helping you along each step of the way.
IntelliPrompt and IntelliSense for template code
When editing template code in code blocks, the editor displays list of class members for a variable as soon as you type period. Once you select a particular method, the editor will display a hint with method signature. Placing text caret on an opening curly brace highlights it and its closing counterpart with green back color, helping you to locate it across text blocks that may be between them.
Support for included T4 files
The editor also provides IntelliSense for included T4 files. Pointing cursor at the DatabaseProject of the LinqToSqlGenerator class included via LinqToSql.tt displays the documentation comments! This is extremely helpful when working with T4 Toolbox templates that use included files extensively.
Conclusion
There is a lot more to the Tangible T4 Editor than would be practical to describe here. I have focused only on those features that help me in my daily work and intentionally left out the UML modeling tools Tangible provides together with the T4 Editor. These modeling tools can be used for building custom code generators as well.
If you are working with T4, I would definitely recommend for you to check it out. The guys at Tangible Engineering work hard to make their T4 Editor compatible with the T4 Toolbox and support complex, composite code generators.
The editor comes in two editions - free and professional. The free edition limits the IntelliSense to a small subset of core .NET assemblies. This version would be appropriate for developer primarily using the T4 code generators created by others. The professional version provides IntelliSense for all assemblies referenced by a T4 code generator and enables strongly typed access to the models created by Tangible modeling tools. Developers who routinely customize or create new T4 code generators will benefit from the additional productivity features offered by the professional edition.
Links
- T4 Editor: http://t4-editor.tangible-engineering.com
- Tangible Engineering: http://www.tangible-engineering.com



Hey Oleg,
Have you seen the Calrius T4 Editor? It’s been out for quite a while as a free beta and now a pro version: http://www.visualt4.com/