A powerful Visual Studio extension for enhanced T4 template editing
T4Editor brings professional-grade syntax highlighting, IntelliSense, and advanced editing features to T4 (Text Template Transformation Toolkit) files in Visual Studio. Whether you're working with code generation, automated documentation, or template-based development, T4Editor transforms your T4 editing experience.
-
Smart T4 Block Recognition: Distinct colors for all T4 block types
-
Control Blocks (
<#...#>
) - For C# statements and control flow -
Class Feature Blocks (
<#+...#>
) - For methods, properties, and class-level features -
Expression Blocks (
<#=...#>
) - For value output expressions -
Directive Blocks (
<#@...#>
) - For template directives and imports -
Output Blocks - Static text content outside T4 tags
-
T4 Tags - The delimiters themselves (
<#
,#>
, etc.)
- Context-Aware Code Completion: Smart suggestions for T4 syntax elements
- Predefined T4 Constructs: Quick insertion of common patterns
- Control block templates
- Class feature block scaffolding
- Expression block helpers
- Import and include directive snippets
- Smart Brace Matching: Highlights matching braces, brackets, parentheses, and quotes
- Code Outlining: Collapsible regions for T4 blocks to manage large templates
- Block Navigation: Easily navigate between related T4 constructs
- Error Detection: Identifies unclosed T4 blocks and syntax issues
- Theme Awareness: Automatically adapts to Visual Studio's light and dark themes
- Customizable Colors: Full control over syntax highlighting colors
- Settings Panel: Easy-to-use configuration interface
- File Support: Works with
.tt
,.t4
, and.ttinclude
files
- Token-Based Parsing: Modern linear parsing approach replaces complex RegEx patterns
- Optimized for Large Files: Efficient parsing for templates over 50KB with minimal performance impact
- Smart Caching: Intelligent result caching for improved responsiveness
- Incremental Processing: Only processes visible areas in large files
- Error-Tolerant: Gracefully handles malformed content without UI freezing
- Future-Ready: Designed to support C# language features within T4 blocks
- Open Visual Studio
- Go to Extensions -> Manage Extensions
- Search for "T4Editor"
- Click Download and restart Visual Studio
Visual Studio Edition | Version Support |
---|---|
Community | 2019 (16.0+), 2022 (17.0+) |
Professional | 2019 (16.0+), 2022 (17.0+) |
Enterprise | 2019 (16.0+), 2022 (17.0+) |
.tt
- T4 Text Templates.t4
- T4 Templates (alternative extension).ttinclude
- T4 Include Files
- Method 1: Go to Tools -> T4Editor Settings
- Method 2: Right-click in a T4 file -> T4Editor Settings
- Syntax Colors: Customize colors for each T4 block type
- Theme Integration: Automatic theme detection and color adjustment
- Performance Settings: Adjust parsing thresholds for large files
- Parser Selection: Choose between token-based and legacy parsing (advanced users)
When you type <#
, T4Editor provides intelligent suggestions:
<#...#>
- Control Block<#+...#>
- Class Feature Block<#=...#>
- Expression Block<#@ import #>
- Import Directive<#@ include #>
- Include Directive
-
Clone the repositorygit clone https://github.com/Tim-Maes/T4Editor.git
-
Prerequisites
- Visual Studio 2019/2022 with VSIX development workload
- .NET Framework 4.7.2
-
Build and Test
- Open T4Editor.sln in Visual Studio
- Build solution (Ctrl+Shift+B)
- Press F5 to run in experimental instance
- Create an issue on GitHub
- Check existing issues for solutions
- Contact the maintainer for support
This project is licensed under the MIT License - see the LICENSE.txt file for details.