| 1 |
{ |
| 2 |
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", |
| 3 |
"name": "jsonnet", |
| 4 |
"patterns": [ |
| 5 |
{ |
| 6 |
"include": "#expression" |
| 7 |
}, |
| 8 |
{ |
| 9 |
"include": "#keywords" |
| 10 |
} |
| 11 |
], |
| 12 |
"repository": { |
| 13 |
"builtin-functions": { |
| 14 |
"patterns": [ |
| 15 |
{ |
| 16 |
"match": "\\bstd[.](acos|asin|atan|ceil|char|codepoint|cos|exp|exponent)\\b", |
| 17 |
"name": "support.function.jsonnet" |
| 18 |
}, |
| 19 |
{ |
| 20 |
"match": "\\bstd[.](filter|floor|force|length|log|makeArray|mantissa)\\b", |
| 21 |
"name": "support.function.jsonnet" |
| 22 |
}, |
| 23 |
{ |
| 24 |
"match": "\\bstd[.](objectFields|objectHas|pow|sin|sqrt|tan|type|thisFile)\\b", |
| 25 |
"name": "support.function.jsonnet" |
| 26 |
}, |
| 27 |
{ |
| 28 |
"match": "\\bstd[.](acos|asin|atan|ceil|char|codepoint|cos|exp|exponent)\\b", |
| 29 |
"name": "support.function.jsonnet" |
| 30 |
}, |
| 31 |
{ |
| 32 |
"match": "\\bstd[.](abs|assertEqual|escapeString(Bash|Dollars|Json|Python))\\b", |
| 33 |
"name": "support.function.jsonnet" |
| 34 |
}, |
| 35 |
{ |
| 36 |
"match": "\\bstd[.](filterMap|flattenArrays|foldl|foldr|format|join)\\b", |
| 37 |
"name": "support.function.jsonnet" |
| 38 |
}, |
| 39 |
{ |
| 40 |
"match": "\\bstd[.](lines|manifest(Ini|Python(Vars)?)|map|max|min|mod)\\b", |
| 41 |
"name": "support.function.jsonnet" |
| 42 |
}, |
| 43 |
{ |
| 44 |
"match": "\\bstd[.](set|set(Diff|Inter|Member|Union)|sort)\\b", |
| 45 |
"name": "support.function.jsonnet" |
| 46 |
}, |
| 47 |
{ |
| 48 |
"match": "\\bstd[.](range|split|stringChars|substr|toString|uniq)\\b", |
| 49 |
"name": "support.function.jsonnet" |
| 50 |
} |
| 51 |
] |
| 52 |
}, |
| 53 |
"comment": { |
| 54 |
"patterns": [ |
| 55 |
{ |
| 56 |
"begin": "/\\*", |
| 57 |
"end": "\\*/", |
| 58 |
"name": "comment.block.jsonnet" |
| 59 |
}, |
| 60 |
{ |
| 61 |
"match": "//.*$", |
| 62 |
"name": "comment.line.jsonnet" |
| 63 |
}, |
| 64 |
{ |
| 65 |
"match": "#.*$", |
| 66 |
"name": "comment.block.jsonnet" |
| 67 |
} |
| 68 |
] |
| 69 |
}, |
| 70 |
"double-quoted-strings": { |
| 71 |
"begin": "\"", |
| 72 |
"end": "\"", |
| 73 |
"name": "string.quoted.double.jsonnet", |
| 74 |
"patterns": [ |
| 75 |
{ |
| 76 |
"match": "\\\\([\"\\\\/bfnrt]|(u[0-9a-fA-F]{4}))", |
| 77 |
"name": "constant.character.escape.jsonnet" |
| 78 |
}, |
| 79 |
{ |
| 80 |
"match": "\\\\[^\"\\\\/bfnrtu]", |
| 81 |
"name": "invalid.illegal.jsonnet" |
| 82 |
} |
| 83 |
] |
| 84 |
}, |
| 85 |
"expression": { |
| 86 |
"patterns": [ |
| 87 |
{ |
| 88 |
"include": "#literals" |
| 89 |
}, |
| 90 |
{ |
| 91 |
"include": "#comment" |
| 92 |
}, |
| 93 |
{ |
| 94 |
"include": "#single-quoted-strings" |
| 95 |
}, |
| 96 |
{ |
| 97 |
"include": "#double-quoted-strings" |
| 98 |
}, |
| 99 |
{ |
| 100 |
"include": "#triple-quoted-strings" |
| 101 |
}, |
| 102 |
{ |
| 103 |
"include": "#builtin-functions" |
| 104 |
}, |
| 105 |
{ |
| 106 |
"include": "#functions" |
| 107 |
} |
| 108 |
] |
| 109 |
}, |
| 110 |
"functions": { |
| 111 |
"patterns": [ |
| 112 |
{ |
| 113 |
"begin": "\\b([a-zA-Z_][a-z0-9A-Z_]*)\\s*\\(", |
| 114 |
"beginCaptures": { |
| 115 |
"1": { |
| 116 |
"name": "entity.name.function.jsonnet" |
| 117 |
} |
| 118 |
}, |
| 119 |
"end": "\\)", |
| 120 |
"name": "meta.function", |
| 121 |
"patterns": [ |
| 122 |
{ |
| 123 |
"include": "#expression" |
| 124 |
} |
| 125 |
] |
| 126 |
} |
| 127 |
] |
| 128 |
}, |
| 129 |
"keywords": { |
| 130 |
"patterns": [ |
| 131 |
{ |
| 132 |
"match": "[!:~\\+\\-&\\|\\^=<>\\*\\/%]", |
| 133 |
"name": "keyword.operator.jsonnet" |
| 134 |
}, |
| 135 |
{ |
| 136 |
"match": "\\$", |
| 137 |
"name": "keyword.other.jsonnet" |
| 138 |
}, |
| 139 |
{ |
| 140 |
"match": "\\b(self|super|import|importstr|local|tailstrict)\\b", |
| 141 |
"name": "keyword.other.jsonnet" |
| 142 |
}, |
| 143 |
{ |
| 144 |
"match": "\\b(if|then|else|for|in|error|assert)\\b", |
| 145 |
"name": "keyword.control.jsonnet" |
| 146 |
}, |
| 147 |
{ |
| 148 |
"match": "\\b(function)\\b", |
| 149 |
"name": "storage.type.jsonnet" |
| 150 |
}, |
| 151 |
{ |
| 152 |
"match": "[a-zA-Z_][a-z0-9A-Z_]*\\s*(:::|\\+:::)", |
| 153 |
"name": "variable.parameter.jsonnet" |
| 154 |
}, |
| 155 |
{ |
| 156 |
"match": "[a-zA-Z_][a-z0-9A-Z_]*\\s*(::|\\+::)", |
| 157 |
"name": "entity.name.type" |
| 158 |
}, |
| 159 |
{ |
| 160 |
"match": "[a-zA-Z_][a-z0-9A-Z_]*\\s*(:|\\+:)", |
| 161 |
"name": "variable.parameter.jsonnet" |
| 162 |
} |
| 163 |
] |
| 164 |
}, |
| 165 |
"literals": { |
| 166 |
"patterns": [ |
| 167 |
{ |
| 168 |
"match": "\\b(true|false|null)\\b", |
| 169 |
"name": "constant.language.jsonnet" |
| 170 |
}, |
| 171 |
{ |
| 172 |
"match": "\\b(\\d+([Ee][+-]?\\d+)?)\\b", |
| 173 |
"name": "constant.numeric.jsonnet" |
| 174 |
}, |
| 175 |
{ |
| 176 |
"match": "\\b\\d+[.]\\d*([Ee][+-]?\\d+)?\\b", |
| 177 |
"name": "constant.numeric.jsonnet" |
| 178 |
}, |
| 179 |
{ |
| 180 |
"match": "\\b[.]\\d+([Ee][+-]?\\d+)?\\b", |
| 181 |
"name": "constant.numeric.jsonnet" |
| 182 |
} |
| 183 |
] |
| 184 |
}, |
| 185 |
"single-quoted-strings": { |
| 186 |
"begin": "'", |
| 187 |
"end": "'", |
| 188 |
"name": "string.quoted.double.jsonnet", |
| 189 |
"patterns": [ |
| 190 |
{ |
| 191 |
"match": "\\\\(['\\\\/bfnrt]|(u[0-9a-fA-F]{4}))", |
| 192 |
"name": "constant.character.escape.jsonnet" |
| 193 |
}, |
| 194 |
{ |
| 195 |
"match": "\\\\[^'\\\\/bfnrtu]", |
| 196 |
"name": "invalid.illegal.jsonnet" |
| 197 |
} |
| 198 |
] |
| 199 |
}, |
| 200 |
"triple-quoted-strings": { |
| 201 |
"patterns": [ |
| 202 |
{ |
| 203 |
"begin": "\\|\\|\\|", |
| 204 |
"end": "\\|\\|\\|", |
| 205 |
"name": "string.quoted.triple.jsonnet" |
| 206 |
} |
| 207 |
] |
| 208 |
} |
| 209 |
}, |
| 210 |
"scopeName": "source.jsonnet" |
| 211 |
} |
| 212 |
|