You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
3.5 KiB
118 lines
3.5 KiB
{
|
|
"scopeName": "source.gotemplate",
|
|
"name": "Go Template",
|
|
"foldingStartMarker": "\\{\\{\\s*(?:if|with|range)\\b",
|
|
"foldingStopMarker": "\\{\\{\\s*(?:else|end)\\b",
|
|
"patterns": [
|
|
{
|
|
"begin": "\\{\\{",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.embedded.begin.gotemplate"
|
|
}
|
|
},
|
|
"end": "\\}\\}",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.embedded.end.gotemplate"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.operator.initialize.gotemplate",
|
|
"match": ":="
|
|
},
|
|
{
|
|
"name": "keyword.operator.pipe.gotemplate",
|
|
"match": "\\|"
|
|
},
|
|
{
|
|
"name": "variable.other.gotemplate",
|
|
"match": "[.$][\\w]*"
|
|
},
|
|
{
|
|
"name": "keyword.control.gotemplate",
|
|
"match": "\\b(if|else|range|template|with|end|nil|with|define)\\b"
|
|
},
|
|
{
|
|
"name": "support.function.builtin.gotemplate",
|
|
"match": "\\b(and|call|html|index|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|le|gt|ge)\\b"
|
|
},
|
|
{
|
|
"begin": "/\\*",
|
|
"end": "\\*/",
|
|
"name": "comment.block.gotemplate"
|
|
},
|
|
{
|
|
"begin": "\"",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.begin.gotemplate"
|
|
}
|
|
},
|
|
"end": "\"",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.end.gotemplate"
|
|
}
|
|
},
|
|
"name": "string.quoted.double.gotemplate",
|
|
"patterns": [
|
|
{
|
|
"include": "#string_placeholder"
|
|
},
|
|
{
|
|
"include": "#string_escaped_char"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"begin": "`",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.begin.gotemplate"
|
|
}
|
|
},
|
|
"end": "`",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.end.gotemplate"
|
|
}
|
|
},
|
|
"name": "string.quoted.raw.gotemplate",
|
|
"patterns": [
|
|
{
|
|
"include": "#string_placeholder"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"repository": {
|
|
"string_escaped_char": {
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.gotemplate",
|
|
"match": "\\\\(\\\\|[abfnrtv'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-7]{3})"
|
|
},
|
|
{
|
|
"name": "invalid.illegal.unknown-escape.gotemplate",
|
|
"match": "\\\\."
|
|
}
|
|
]
|
|
},
|
|
"string_placeholder": {
|
|
"patterns": [
|
|
{
|
|
"name": "constant.other.placeholder.gotemplate",
|
|
"match": "(?x)%\n (\\d+\\$)? # field (argument #)\n [#0\\- +']* # flags\n [,;:_]? # separator character (AltiVec)\n ((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n (\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n [diouxXDOUeEfFgGaAcCsSqpnvtTbyYhHmMzZ%] # conversion type\n "
|
|
},
|
|
{
|
|
"name": "invalid.illegal.placeholder.gotemplate",
|
|
"match": "%"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|