Skip to main content

Module token

Module token 

Source
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:

ConstructToken
foo barSnippetToken::Literal
$1, $0, $99SnippetToken::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§

ChoiceOption
Choice placeholder option (${1|opt1,opt2,opt3|} -> three options). Stored verbatim; the picker UI renders them as alternatives.
SnippetBody
A parsed snippet body. Just a wrapper over the token vec so the type signature in registry / load / render stays readable.

Enums§

SnippetToken
One token from a parsed snippet body.
TransformTarget
What a Transform token applies to.