Syntax highlighting for spintax templates in Visual Studio Code —
engine-accurate against the @spintax/core
contract and verified headlessly with vscode-tmgrammar-test. Applies to .spintax files.
Prefer a dedicated workspace? Spintax Studio
is a native desktop editor for spintax — source and live preview side by side, validation
with precise diagnostics, variant generation and export — built on the same engine this
grammar is measured against (source).
Construct
Example
Enumeration
{a|b|c}
Permutation
[<minsize=2;maxsize=3;sep=", ">a|b|c]
Variable
%name%
Local set
#set %name% = value — macro, re-rolled at every reference
Local def
#def %name% = value — resolved once per render, held everywhere
Include
#include "slug-or-id"
Conditional
{?VAR?then|else} · {?!VAR?…}
Plural
{plural %n%: one|few|many}
Comment
/# … #/
Example
/# hero block #/
#set %product% = Acme
#def %tone% = {friendly|warm}
{Welcome to|Meet} %product% — %tagline%, trusted since {2019|2020}.
Ships with [<minsize=2;maxsize=3;sep=", ";lastsep=" and ">SSO|audit logs|alerts]{?free? — free tier available|}.
You have %n% {plural %n%: message|messages}.
Install
Marketplace: open the Extensions view (Ctrl/Cmd+Shift+X),
search Spintax, and install — or run code --install-extension 301st.spintax.
From VSIX: download the .vsix from the latest release
and run Extensions: Install from VSIX….
Features
Full, engine-accurate tokenization of every spintax construct, including nested spintax
inside conditional branches and enumerations.
Correct permutation config:<minsize=…;sep=…> is config — case-insensitive keys,
quote-aware values (<sep="a>b"> is one config), blanks allowed after the [ — while
HTML inside items ([<li>a</li>|b], [<a href="/x">…</a>|b], even a key-shaped
attribute like [<li data-sep=1>…</li>|b]) is content, not mis-highlighted as config.
Genuine separators ([<and>a|b], [a<, >|b]) are highlighted.
Engine-true trailing separators: recognised exactly where the engine extracts them —
before a |, never before the closing ] — including literal brace separators
([x<{a|b}>|y]), while HTML-ish forms ([a</b>|c], [a<br/>|c]) stay content.
Directives highlight after closed inline comments on the same logical line
(/# note #/#set %x% = 1), because the engine strips comments before reading directives.
Strict conditional / plural openers — {??x} and {plural noun} are not mis-highlighted.
Block-comment toggle (/# … #/) and auto-closing of {}, [], %%, "".