Skip to main content

parse_snippet

Function parse_snippet 

Source
pub fn parse_snippet(snippet: &str) -> SnippetTemplate
Expand description

Parse a TextMate/VS Code-style snippet string into an expanded template.

Supported constructs (best-effort):

  • $1, $2, … tabstops
  • ${1}, ${1:default}
  • ${1|a,b,c|} (inserts the first option; selects as placeholder)
  • $0 / ${0} final caret position
  • ${VAR} / ${VAR:default} variables (unresolved; default is used when provided)

Unsupported constructs are ignored or treated as literal text where reasonable.