Expand description
Render a parsed SnippetBody to literal text plus
per-tabstop byte ranges. Output feeds the editor’s edit
pipeline (insert the text, then track the ranges as the
user types into placeholders).
Variables are resolved against the supplied
VariableContext – unknown variables fall back to their
default body when present, else the empty string. Choice
placeholders render their first option as the initial
placeholder text; the host’s choice-picker UI lets the
user swap.
Transformations parse but render as the bound text un- transformed in v1; full regex support lands as polish. Snippet bodies in the wild rarely use transformations.
Structs§
- Rendered
Snippet - Output of
render. Contains the literal text the editor inserts plus the tabstop ranges grouped by index for easy navigation. - Tabstop
Range - Byte range a tabstop covers in the rendered text. Multiple
occurrences of the same tabstop index produce one
TabstopRangeper occurrence – they’re “mirrors”; edits in one ripple to the others.
Functions§
- render
- Render the parsed body to text + tabstop ranges.