https://github.com/tim-maes/t4editor
Enhance your T4 experience in Visual Studio.
https://github.com/tim-maes/t4editor
csharp editor mef t4 text-templating vsix vsix-extension vsix-extensions
Last synced: 3 days ago
JSON representation
Enhance your T4 experience in Visual Studio.
- Host: GitHub
- URL: https://github.com/tim-maes/t4editor
- Owner: Tim-Maes
- License: mit
- Created: 2021-09-29T11:48:31.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-04T13:18:20.000Z (almost 2 years ago)
- Last Synced: 2024-05-02T04:57:45.888Z (over 1 year ago)
- Topics: csharp, editor, mef, t4, text-templating, vsix, vsix-extension, vsix-extensions
- Language: C#
- Homepage:
- Size: 141 KB
- Stars: 23
- Watchers: 4
- Forks: 6
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# T4Editor
![]()
A powerful Visual Studio extension for enhanced T4 template editing|Build Status| Downloads |
|------------|------------|
|?branchName=master)||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.
## Key Features
### **Advanced Syntax Highlighting**
- **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.)### **Intelligent IntelliSense**
- **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### **Advanced Editor Features**
- **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### **Visual Studio Integration**
- **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### **High Performance**
- **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## Installation
### Visual Studio Marketplace
1. Open Visual Studio
2. Go to **Extensions** -> **Manage Extensions**
3. Search for "T4Editor"
4. Click **Download** and restart Visual Studio## Supported Versions
| 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+) |## Supported File Types
- **`.tt`** - T4 Text Templates
- **`.t4`** - T4 Templates (alternative extension)
- **`.ttinclude`** - T4 Include Files## Configuration
### Accessing Settings
- **Method 1**: Go to **Tools** -> **T4Editor Settings**
- **Method 2**: Right-click in a T4 file -> **T4Editor Settings**### Customization Options
- **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)### IntelliSense in Action
When you type `<#`, T4Editor provides intelligent suggestions:
- `<#...#>` - Control Block
- `<#+...#>` - Class Feature Block
- `<#=...#>` - Expression Block
- `<#@ import #>` - Import Directive
- `<#@ include #>` - Include Directive## Demo

## Contributing
### Development Setup
1. **Clone the repository**git clone https://github.com/Tim-Maes/T4Editor.git
2. **Prerequisites**
- Visual Studio 2019/2022 with VSIX development workload
- .NET Framework 4.7.23. **Build and Test**
- Open T4Editor.sln in Visual Studio
- Build solution (Ctrl+Shift+B)
- Press F5 to run in experimental instance## Troubleshooting
### Getting Help
- [Create an issue](https://github.com/Tim-Maes/T4Editor/issues) on GitHub
- Check existing issues for solutions
- Contact the maintainer for support## License
This project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details.