Syntax highlighting for Fenom template engine in VSCode.
- Syntax highlighting for Fenom template tags and expressions
- Support for Fenom 3.x operators:
??,?.,?->,~,~~,~=,..,->,::,?: - Highlighting for keywords:
if,else,elseif,foreach,foreachelse,set,var,include,insert,block,extends,parent,as,default,matches,not, and more - Variable, string, number, modifier, operator, and comment highlighting
- Bracket matching and auto-closing
- Code folding for control structures
Search for "Fenom" in VSCode extensions and install.
# Clone the repository
git clone https://github.com/maxisoft/fenom-vscode.git
cd fenom-vscode
# Install dependencies (if needed for development)
npm install
# Package the extension
vsce package
# Install from local .vsix
code --install-extension fenom-*.vsixThe extension recognizes:
*.fenom*.fm*.tpl(manual association via VSCode File Associations settings)
{* Template comment *}
<h1>{$title|default:'Hello World'}</h1>
{set $user = $app->getUser()}
{if $user?->name ?? 'Guest'}
<p>Welcome, {$user?->name}!</p>
<p>City: {$user?.address?.city}</p>
{elseif $name is not empty}
<p>Hello {$name ~ '!'}</p>
{else}
<p>Welcome, stranger!</p>
{/if}
{foreach $items as $item index $i}
{if $item.published}
<div>{$i}. {$item.title} — {$item.price ?? 'free'}</div>
{/if}
{foreachelse}
<p>No items found.</p>
{/foreach}
{include 'pagination.tpl' pages=$pages}
This extension is a port of the IntelliJ IDEA plugin to VSCode.
The syntax highlighting is defined using TextMate grammars (fenom.tmLanguage.json), which are converted from the original JFlex lexer definitions:
- FenomTop.flex → Top-level grammar (HTML vs macro detection)
- FenomSub.flex → Macro body grammar (variables, modifiers, operators)
# Install vsce if not already installed
npm install -g vsce
# Package
vsce package
# Publish (requires publisher token)
vsce publishMIT License - see LICENSE file.