Expand description
Snippet parsing + placeholder navigation primitives.
This module implements a pragmatic subset of TextMate / VS Code snippet syntax that is sufficient for kernel features like:
- LSP completion items with
insertTextFormat == 2(snippets) - placeholder (
$1,${1:default}) navigation (tab / shift-tab) - best-effort handling of choices (
${1|a,b,c|}) and variables (${TM_FILENAME:foo.rs})
Goals:
- Keep the kernel UI-agnostic: no rendering, no popup UI for choices.
- Prefer “do something reasonable” over rejecting malformed snippet text.
- Express all ranges in character offsets (Rust
charindices), consistent with the rest ofeditor-core.
Structs§
- Snippet
Range - A half-open character range (start..end) within a snippet’s expanded text.
- Snippet
Session - An active snippet session tracked in document coordinates.
- Snippet
Tabstop - A numbered tabstop within a snippet.
- Snippet
Template - An expanded snippet template.
Functions§
- parse_
snippet - Parse a TextMate/VS Code-style snippet string into an expanded template.