Expand description
TextMate JSON loader – the format VS Code uses and
friendly-snippets ships in. Reading a friendly-snippets
pack is a matter of pointing at its JSON files; no
conversion or shim code.
Format:
{
"for loop": {
"prefix": "for",
"body": [
"for ${1:i} in ${2:iter} {",
"\t$0",
"}"
],
"description": "for-in loop"
},
"impl Display": {
"prefix": ["impl_display", "displ"],
"body": ["impl Display for ${1:Ty} { ... }"],
"description": "implement Display"
}
}prefix: string OR string array.body: string OR string array (joined with\n).description: optional string.scope: optional string (comma-separated source scopes).
Top-level keys are snippet names (free-form). Unknown fields are ignored – forward-compatible with VS Code’s occasional extensions.
Enums§
- Load
Error - Snippet load error. Wraps JSON / parse failures so callers can surface a clear “snippet pack X failed” message.
Functions§
- load_
pack - Parse a friendly-snippets-style JSON pack. Each entry
becomes a
Snippet; the body is parsed eagerly so the per-keystrokegen:snippetsource doesn’t pay re-parse cost. - load_
pack_ from_ str - Convenience: parse a JSON string directly. Most loader call sites read a file then route through here.