PieTemplate VS Code Extension
PieTemplate is a Visual Studio Code extension that provides syntax highlighting and an improved editing experience for PHP-based template files using custom directives (Blade-like style) with the .pie.php extension.
This extension focuses purely on editor support — it does not render or execute templates.
✨ Features
- Syntax highlighting for
.pie.php files
- Full HTML support with proper coloring
- PHP language support inside:
<?php ... ?>
<?= ... ?>
{{ ... }}
- Highlighting for Pie directives:
@if, @elseif, @else, @endif
@for, @foreach, @while
@endfor, @endforeach, @endwhile
@part, @endpart
@slot, @use
- Compatible with Intelephense for PHP IntelliSense
- Does not interfere with built-in HTML or PHP grammars
📂 File Extension
PieTemplate is automatically enabled for files with the following extension:
.pie.php
🧠 Example
<div class="card">
@if($user)
<h3>{{ $user->name }}</h3>
@else
<span>Guest</span>
@endif
</div>
Editor behavior:
- HTML is highlighted normally
- Pie directives are colored as keywords
{{ ... }} is treated as PHP expression
- PHP variables and functions are recognized by Intelephense
🎨 Language Mode
This extension registers a custom language in VS Code:
PieTemplate
If it is not selected automatically:
- Open a
.pie.php file
- Click the language selector (bottom-right corner)
- Choose PieTemplate
⚠️ Important Notes
Do NOT use files.associations
Avoid adding the following configuration to your settings.json:
"files.associations": {
"*.pie.php": "php"
}
This will:
- Disable PieTemplate grammar
- Remove directive highlighting
- Prevent PieTemplate language from activating
Let VS Code handle the language automatically.
🧩 Scope & Limitations
This extension does not:
- Render or compile templates
- Validate directive pairing (
@if / @endif)
- Replace Blade or other PHP template engines
This extension only enhances editor experience:
- Readability
- Syntax structure
- PHP IntelliSense inside templates
🛠️ Technology
- TextMate Grammar (
.tmLanguage.json)
- Built-in VS Code HTML grammar
- Built-in VS Code PHP grammar
- Intelephense for PHP IntelliSense
🚀 Roadmap
- Directive snippets
- Directive autocomplete
- Basic formatter for PieTemplate
- Improved nested directive scopes
- Directive pairing hints
🤝 Contributing
Contributions and ideas are welcome.
This extension is suitable for:
- Custom PHP frameworks
- Experimental template engines
- Learning VS Code extension development
📜 License
MIT License