T4Editor VS2019 Extension: Syntax highlighting for T4 Templates

Several developers complain about the lack of a proper T4 editor experience, as everything is just shown as plain text. See my other T4 tutorials to see the regular T4 text files in the header image.

I created a Visual Studio extension called T4Editor that adds colors to different blocks in you code. You can easily spot the difference between output code, control blocks and class feature blocks. This increases coding productivity and readability of your T4 templates.

In the future, C# code inside these blocks will also be highlighted with the propper C# syntax colors, I’m still working on that.

Update: Now you can set custom colors! Navigate to Extensions – T4Editor – Adjust Colors and pick whatever colors you want.

Update 2: There is now code completion/minor custom intellisense for codeblocks!

Update 4: I have implemented brace matching and improved RegEx. Typing ‘var string = “#>” for example, will not act as a closing tag.

Click here to see the code. Feel free to give feedback or even contribute!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s