Expand description
Parsed snippet body: the token stream a crate::parse::parse
produces and crate::render::render walks.
Tokens map 1:1 to TextMate / LSP snippet syntax constructs
plus a tail Literal for plain text runs:
| Construct | Token |
|---|---|
foo bar | SnippetToken::Literal |
$1, $0, $99 | SnippetToken::Tabstop |
${1:default text} | SnippetToken::Placeholder |
${1|opt1,opt2,opt3|} | SnippetToken::Choice |
$VAR / ${VAR} | SnippetToken::Variable |
${VAR:fallback} | SnippetToken::Variable (with default) |
${1/pat/repl/flags} / ${VAR/pat/repl/flags} | SnippetToken::Transform |
\$, \\, \} | unescaped → contributes to a SnippetToken::Literal |
Structs§
- Choice
Option - Choice placeholder option (
${1|opt1,opt2,opt3|}-> three options). Stored verbatim; the picker UI renders them as alternatives. - Snippet
Body - A parsed snippet body. Just a wrapper over the token vec so the type signature in registry / load / render stays readable.
Enums§
- Snippet
Token - One token from a parsed snippet body.
- Transform
Target - What a
Transformtoken applies to.