Files
dev/lib/zap.tmLanguage.json
zeekay b5c52729a0 docs: register ZAP TextMate grammar with Shiki to fix ShikiError
```zap fences in rpc/schema/sdks were throwing
'ShikiError: Language zap is not included in this bundle' at render,
turning the static export RED. Vendor ZAP's TextMate grammar (source.zap)
from luxfi zap/syntax and pass it to Shiki via the docs-mdx preset's
rehypeCodeOptions.langs. capnp needs no handling — SchemaTabs highlights
it itself; no capnp fences exist.

Build: pnpm build -> exit 0, 44/44 static pages, zap keywords highlighted.
2026-06-21 08:18:33 -07:00

249 lines
6.3 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "zap",
"displayName": "ZAP",
"aliases": ["zaps"],
"scopeName": "source.zap",
"fileTypes": ["zap", "zaps"],
"patterns": [
{ "include": "#comments" },
{ "include": "#annotations" },
{ "include": "#keywords" },
{ "include": "#types" },
{ "include": "#strings" },
{ "include": "#numbers" },
{ "include": "#constants" },
{ "include": "#identifiers" },
{ "include": "#operators" },
{ "include": "#punctuation" }
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.line.number-sign.zap",
"match": "#.*$"
},
{
"name": "comment.line.double-slash.zap",
"match": "//.*$"
},
{
"name": "comment.block.zap",
"begin": "/\\*",
"end": "\\*/",
"patterns": [
{
"name": "comment.block.zap",
"match": "."
}
]
}
]
},
"annotations": {
"patterns": [
{
"name": "entity.name.function.decorator.zap",
"match": "@[a-zA-Z_][a-zA-Z0-9_]*"
},
{
"name": "constant.numeric.field-id.zap",
"match": "@[0-9]+"
},
{
"name": "keyword.other.unique-id.zap",
"match": "@0x[0-9a-fA-F]+"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.zap",
"match": "\\b(struct|enum|interface|union|group|service|rpc|method)\\b"
},
{
"name": "keyword.other.zap",
"match": "\\b(import|using|const|annotation|extends|implements|returns|throws|stream)\\b"
},
{
"name": "keyword.modifier.zap",
"match": "\\b(inline|packed|aligned|deprecated|optional|required|repeated)\\b"
},
{
"name": "keyword.control.flow.zap",
"match": "\\b(in|of|on|as|with|from|to|for)\\b"
}
]
},
"types": {
"patterns": [
{
"name": "storage.type.primitive.zap",
"match": "\\b(Void|Bool|Int8|Int16|Int32|Int64|UInt8|UInt16|UInt32|UInt64|Float32|Float64)\\b"
},
{
"name": "storage.type.primitive.alias.zap",
"match": "\\b(i8|i16|i32|i64|u8|u16|u32|u64|f32|f64|bool|void)\\b"
},
{
"name": "storage.type.composite.zap",
"match": "\\b(Text|Data|Bytes|String|List|Map|Set|Option|Result|AnyPointer|AnyStruct|Capability)\\b"
},
{
"name": "storage.type.generic.zap",
"match": "\\b[A-Z][a-zA-Z0-9_]*\\b(?=\\s*[<\\(\\{]|\\s*@|\\s*:)"
},
{
"name": "entity.name.type.zap",
"match": "\\b[A-Z][a-zA-Z0-9_]*\\b"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.zap",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.zap",
"match": "\\\\(?:[0-7]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[abfnrtv\\\\\"'])"
}
]
},
{
"name": "string.quoted.single.zap",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.zap",
"match": "\\\\."
}
]
},
{
"name": "string.quoted.raw.zap",
"begin": "`",
"end": "`"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.hex.zap",
"match": "\\b0[xX][0-9a-fA-F_]+\\b"
},
{
"name": "constant.numeric.binary.zap",
"match": "\\b0[bB][01_]+\\b"
},
{
"name": "constant.numeric.octal.zap",
"match": "\\b0[oO][0-7_]+\\b"
},
{
"name": "constant.numeric.float.zap",
"match": "\\b[0-9][0-9_]*\\.[0-9_]+([eE][+-]?[0-9_]+)?\\b"
},
{
"name": "constant.numeric.float.exponent.zap",
"match": "\\b[0-9][0-9_]*[eE][+-]?[0-9_]+\\b"
},
{
"name": "constant.numeric.integer.zap",
"match": "\\b[0-9][0-9_]*\\b"
}
]
},
"constants": {
"patterns": [
{
"name": "constant.language.boolean.zap",
"match": "\\b(true|false)\\b"
},
{
"name": "constant.language.null.zap",
"match": "\\b(null|nil|void)\\b"
},
{
"name": "constant.language.infinity.zap",
"match": "\\b(inf|nan)\\b"
}
]
},
"identifiers": {
"patterns": [
{
"name": "variable.other.field.zap",
"match": "\\b[a-z_][a-zA-Z0-9_]*\\b(?=\\s*@)"
},
{
"name": "variable.other.zap",
"match": "\\b[a-z_][a-zA-Z0-9_]*\\b"
}
]
},
"operators": {
"patterns": [
{
"name": "keyword.operator.assignment.zap",
"match": "="
},
{
"name": "keyword.operator.arrow.zap",
"match": "->"
},
{
"name": "keyword.operator.type.zap",
"match": ":"
}
]
},
"punctuation": {
"patterns": [
{
"name": "punctuation.definition.block.begin.zap",
"match": "\\{"
},
{
"name": "punctuation.definition.block.end.zap",
"match": "\\}"
},
{
"name": "punctuation.definition.parameters.begin.zap",
"match": "\\("
},
{
"name": "punctuation.definition.parameters.end.zap",
"match": "\\)"
},
{
"name": "punctuation.definition.generic.begin.zap",
"match": "<"
},
{
"name": "punctuation.definition.generic.end.zap",
"match": ">"
},
{
"name": "punctuation.definition.array.begin.zap",
"match": "\\["
},
{
"name": "punctuation.definition.array.end.zap",
"match": "\\]"
},
{
"name": "punctuation.separator.zap",
"match": "[,;]"
}
]
}
}
}