| 1 |
{ |
| 2 |
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", |
| 3 |
"name": "prisma", |
| 4 |
"scopeName": "source.prisma", |
| 5 |
"fileTypes": ["prisma"], |
| 6 |
"patterns": [ |
| 7 |
{ |
| 8 |
"include": "#triple_comment" |
| 9 |
}, |
| 10 |
{ |
| 11 |
"include": "#double_comment" |
| 12 |
}, |
| 13 |
{ |
| 14 |
"include": "#model_block_definition" |
| 15 |
}, |
| 16 |
{ |
| 17 |
"include": "#config_block_definition" |
| 18 |
}, |
| 19 |
{ |
| 20 |
"include": "#enum_block_definition" |
| 21 |
}, |
| 22 |
{ |
| 23 |
"include": "#type_definition" |
| 24 |
} |
| 25 |
], |
| 26 |
"repository": { |
| 27 |
"model_block_definition": { |
| 28 |
"begin": "^\\s*(model|type|view)\\s+([A-Za-z][\\w]*)\\s*({)", |
| 29 |
"name": "source.prisma.embedded.source", |
| 30 |
"beginCaptures": { |
| 31 |
"1": { |
| 32 |
"name": "storage.type.model.prisma" |
| 33 |
}, |
| 34 |
"2": { |
| 35 |
"name": "entity.name.type.model.prisma" |
| 36 |
}, |
| 37 |
"3": { |
| 38 |
"name": "punctuation.definition.tag.prisma" |
| 39 |
} |
| 40 |
}, |
| 41 |
"patterns": [ |
| 42 |
{ |
| 43 |
"include": "#triple_comment" |
| 44 |
}, |
| 45 |
{ |
| 46 |
"include": "#double_comment" |
| 47 |
}, |
| 48 |
{ |
| 49 |
"include": "#field_definition" |
| 50 |
} |
| 51 |
], |
| 52 |
"end": "\\s*\\}", |
| 53 |
"endCaptures": { |
| 54 |
"0": { |
| 55 |
"name": "punctuation.definition.tag.prisma" |
| 56 |
} |
| 57 |
} |
| 58 |
}, |
| 59 |
"enum_block_definition": { |
| 60 |
"begin": "^\\s*(enum)\\s+([A-Za-z][\\w]*)\\s+({)", |
| 61 |
"name": "source.prisma.embedded.source", |
| 62 |
"beginCaptures": { |
| 63 |
"1": { |
| 64 |
"name": "storage.type.enum.prisma" |
| 65 |
}, |
| 66 |
"2": { |
| 67 |
"name": "entity.name.type.enum.prisma" |
| 68 |
}, |
| 69 |
"3": { |
| 70 |
"name": "punctuation.definition.tag.prisma" |
| 71 |
} |
| 72 |
}, |
| 73 |
"patterns": [ |
| 74 |
{ |
| 75 |
"include": "#triple_comment" |
| 76 |
}, |
| 77 |
{ |
| 78 |
"include": "#double_comment" |
| 79 |
}, |
| 80 |
{ |
| 81 |
"include": "#enum_value_definition" |
| 82 |
} |
| 83 |
], |
| 84 |
"end": "\\s*\\}", |
| 85 |
"endCaptures": { |
| 86 |
"0": { |
| 87 |
"name": "punctuation.definition.tag.prisma" |
| 88 |
} |
| 89 |
} |
| 90 |
}, |
| 91 |
"config_block_definition": { |
| 92 |
"begin": "^\\s*(generator|datasource)\\s+([A-Za-z][\\w]*)\\s+({)", |
| 93 |
"name": "source.prisma.embedded.source", |
| 94 |
"beginCaptures": { |
| 95 |
"1": { |
| 96 |
"name": "storage.type.config.prisma" |
| 97 |
}, |
| 98 |
"2": { |
| 99 |
"name": "entity.name.type.config.prisma" |
| 100 |
}, |
| 101 |
"3": { |
| 102 |
"name": "punctuation.definition.tag.prisma" |
| 103 |
} |
| 104 |
}, |
| 105 |
"patterns": [ |
| 106 |
{ |
| 107 |
"include": "#triple_comment" |
| 108 |
}, |
| 109 |
{ |
| 110 |
"include": "#double_comment" |
| 111 |
}, |
| 112 |
{ |
| 113 |
"include": "#assignment" |
| 114 |
} |
| 115 |
], |
| 116 |
"end": "\\s*\\}", |
| 117 |
"endCaptures": { |
| 118 |
"1": { |
| 119 |
"name": "punctuation.definition.tag.prisma" |
| 120 |
} |
| 121 |
} |
| 122 |
}, |
| 123 |
"assignment": { |
| 124 |
"patterns": [ |
| 125 |
{ |
| 126 |
"begin": "^\\s*(\\w+)\\s*(=)\\s*", |
| 127 |
"beginCaptures": { |
| 128 |
"1": { |
| 129 |
"name": "variable.other.assignment.prisma" |
| 130 |
}, |
| 131 |
"2": { |
| 132 |
"name": "keyword.operator.terraform" |
| 133 |
} |
| 134 |
}, |
| 135 |
"patterns": [ |
| 136 |
{ |
| 137 |
"include": "#value" |
| 138 |
}, |
| 139 |
{ |
| 140 |
"include": "#double_comment_inline" |
| 141 |
} |
| 142 |
], |
| 143 |
"end": "\\n" |
| 144 |
} |
| 145 |
] |
| 146 |
}, |
| 147 |
"field_definition": { |
| 148 |
"name": "scalar.field", |
| 149 |
"patterns": [ |
| 150 |
{ |
| 151 |
"match": "^\\s*(\\w+)(\\s*:)?\\s+((?!(?:Int|BigInt|String|DateTime|Bytes|Decimal|Float|Json|Boolean)\\b)\\b\\w+)?(Int|BigInt|String|DateTime|Bytes|Decimal|Float|Json|Boolean)?(\\[\\])?(\\?)?(\\!)?", |
| 152 |
"captures": { |
| 153 |
"1": { |
| 154 |
"name": "variable.other.assignment.prisma" |
| 155 |
}, |
| 156 |
"2": { |
| 157 |
"name": "invalid.illegal.colon.prisma" |
| 158 |
}, |
| 159 |
"3": { |
| 160 |
"name": "variable.language.relations.prisma" |
| 161 |
}, |
| 162 |
"4": { |
| 163 |
"name": "support.type.primitive.prisma" |
| 164 |
}, |
| 165 |
"5": { |
| 166 |
"name": "keyword.operator.list_type.prisma" |
| 167 |
}, |
| 168 |
"6": { |
| 169 |
"name": "keyword.operator.optional_type.prisma" |
| 170 |
}, |
| 171 |
"7": { |
| 172 |
"name": "invalid.illegal.required_type.prisma" |
| 173 |
} |
| 174 |
} |
| 175 |
}, |
| 176 |
{ |
| 177 |
"include": "#attribute_with_arguments" |
| 178 |
}, |
| 179 |
{ |
| 180 |
"include": "#attribute" |
| 181 |
} |
| 182 |
] |
| 183 |
}, |
| 184 |
"type_definition": { |
| 185 |
"patterns": [ |
| 186 |
{ |
| 187 |
"match": "^\\s*(type)\\s+(\\w+)\\s*=\\s*(\\w+)", |
| 188 |
"captures": { |
| 189 |
"1": { |
| 190 |
"name": "storage.type.type.prisma" |
| 191 |
}, |
| 192 |
"2": { |
| 193 |
"name": "entity.name.type.type.prisma" |
| 194 |
}, |
| 195 |
"3": { |
| 196 |
"name": "support.type.primitive.prisma" |
| 197 |
} |
| 198 |
} |
| 199 |
}, |
| 200 |
{ |
| 201 |
"include": "#attribute_with_arguments" |
| 202 |
}, |
| 203 |
{ |
| 204 |
"include": "#attribute" |
| 205 |
} |
| 206 |
] |
| 207 |
}, |
| 208 |
"enum_value_definition": { |
| 209 |
"patterns": [ |
| 210 |
{ |
| 211 |
"match": "^\\s*(\\w+)\\s*", |
| 212 |
"captures": { |
| 213 |
"1": { |
| 214 |
"name": "variable.other.assignment.prisma" |
| 215 |
} |
| 216 |
} |
| 217 |
}, |
| 218 |
{ |
| 219 |
"include": "#attribute_with_arguments" |
| 220 |
}, |
| 221 |
{ |
| 222 |
"include": "#attribute" |
| 223 |
} |
| 224 |
] |
| 225 |
}, |
| 226 |
"attribute_with_arguments": { |
| 227 |
"name": "source.prisma.attribute.with_arguments", |
| 228 |
"begin": "(@@?[\\w\\.]+)(\\()", |
| 229 |
"beginCaptures": { |
| 230 |
"1": { |
| 231 |
"name": "entity.name.function.attribute.prisma" |
| 232 |
}, |
| 233 |
"2": { |
| 234 |
"name": "punctuation.definition.tag.prisma" |
| 235 |
} |
| 236 |
}, |
| 237 |
"patterns": [ |
| 238 |
{ |
| 239 |
"include": "#named_argument" |
| 240 |
}, |
| 241 |
{ |
| 242 |
"include": "#value" |
| 243 |
} |
| 244 |
], |
| 245 |
"end": "\\)", |
| 246 |
"endCaptures": { |
| 247 |
"0": { |
| 248 |
"name": "punctuation.definition.tag.prisma" |
| 249 |
} |
| 250 |
} |
| 251 |
}, |
| 252 |
"attribute": { |
| 253 |
"name": "source.prisma.attribute", |
| 254 |
"match": "(@@?[\\w\\.]+)", |
| 255 |
"captures": { |
| 256 |
"1": { |
| 257 |
"name": "entity.name.function.attribute.prisma" |
| 258 |
} |
| 259 |
} |
| 260 |
}, |
| 261 |
"array": { |
| 262 |
"name": "source.prisma.array", |
| 263 |
"begin": "\\[", |
| 264 |
"beginCaptures": { |
| 265 |
"1": { |
| 266 |
"name": "punctuation.definition.tag.prisma" |
| 267 |
} |
| 268 |
}, |
| 269 |
"patterns": [ |
| 270 |
{ |
| 271 |
"include": "#value" |
| 272 |
} |
| 273 |
], |
| 274 |
"end": "\\]", |
| 275 |
"endCaptures": { |
| 276 |
"1": { |
| 277 |
"name": "punctuation.definition.tag.prisma" |
| 278 |
} |
| 279 |
} |
| 280 |
}, |
| 281 |
"value": { |
| 282 |
"name": "source.prisma.value", |
| 283 |
"patterns": [ |
| 284 |
{ |
| 285 |
"include": "#array" |
| 286 |
}, |
| 287 |
{ |
| 288 |
"include": "#functional" |
| 289 |
}, |
| 290 |
{ |
| 291 |
"include": "#literal" |
| 292 |
} |
| 293 |
] |
| 294 |
}, |
| 295 |
"functional": { |
| 296 |
"name": "source.prisma.functional", |
| 297 |
"begin": "(\\w+)(\\()", |
| 298 |
"beginCaptures": { |
| 299 |
"1": { |
| 300 |
"name": "support.function.functional.prisma" |
| 301 |
}, |
| 302 |
"2": { |
| 303 |
"name": "punctuation.definition.tag.prisma" |
| 304 |
} |
| 305 |
}, |
| 306 |
"patterns": [ |
| 307 |
{ |
| 308 |
"include": "#value" |
| 309 |
} |
| 310 |
], |
| 311 |
"end": "\\)", |
| 312 |
"endCaptures": { |
| 313 |
"0": { |
| 314 |
"name": "punctuation.definition.tag.prisma" |
| 315 |
} |
| 316 |
} |
| 317 |
}, |
| 318 |
"literal": { |
| 319 |
"name": "source.prisma.literal", |
| 320 |
"patterns": [ |
| 321 |
{ |
| 322 |
"include": "#boolean" |
| 323 |
}, |
| 324 |
{ |
| 325 |
"include": "#number" |
| 326 |
}, |
| 327 |
{ |
| 328 |
"include": "#double_quoted_string" |
| 329 |
}, |
| 330 |
{ |
| 331 |
"include": "#identifier" |
| 332 |
} |
| 333 |
] |
| 334 |
}, |
| 335 |
"identifier": { |
| 336 |
"patterns": [ |
| 337 |
{ |
| 338 |
"match": "\\b(\\w)+\\b", |
| 339 |
"name": "support.constant.constant.prisma" |
| 340 |
} |
| 341 |
] |
| 342 |
}, |
| 343 |
"map_key": { |
| 344 |
"name": "source.prisma.key", |
| 345 |
"patterns": [ |
| 346 |
{ |
| 347 |
"match": "(\\w+)\\s*(:)\\s*", |
| 348 |
"captures": { |
| 349 |
"1": { |
| 350 |
"name": "variable.parameter.key.prisma" |
| 351 |
}, |
| 352 |
"2": { |
| 353 |
"name": "punctuation.definition.separator.key-value.prisma" |
| 354 |
} |
| 355 |
} |
| 356 |
} |
| 357 |
] |
| 358 |
}, |
| 359 |
"named_argument": { |
| 360 |
"name": "source.prisma.named_argument", |
| 361 |
"patterns": [ |
| 362 |
{ |
| 363 |
"include": "#map_key" |
| 364 |
}, |
| 365 |
{ |
| 366 |
"include": "#value" |
| 367 |
} |
| 368 |
] |
| 369 |
}, |
| 370 |
"triple_comment": { |
| 371 |
"begin": "///", |
| 372 |
"end": "$\\n?", |
| 373 |
"name": "comment.prisma" |
| 374 |
}, |
| 375 |
"double_comment": { |
| 376 |
"begin": "//", |
| 377 |
"end": "$\\n?", |
| 378 |
"name": "comment.prisma" |
| 379 |
}, |
| 380 |
"double_comment_inline": { |
| 381 |
"match": "//[^\\n]*", |
| 382 |
"name": "comment.prisma" |
| 383 |
}, |
| 384 |
"boolean": { |
| 385 |
"match": "\\b(true|false)\\b", |
| 386 |
"name": "constant.language.boolean.prisma" |
| 387 |
}, |
| 388 |
"number": { |
| 389 |
"match": "((0(x|X)[0-9a-fA-F]*)|(\\+|-)?\\b(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)([LlFfUuDdg]|UL|ul)?\\b", |
| 390 |
"name": "constant.numeric.prisma" |
| 391 |
}, |
| 392 |
"double_quoted_string": { |
| 393 |
"begin": "\"", |
| 394 |
"beginCaptures": { |
| 395 |
"0": { |
| 396 |
"name": "string.quoted.double.start.prisma" |
| 397 |
} |
| 398 |
}, |
| 399 |
"end": "\"", |
| 400 |
"endCaptures": { |
| 401 |
"0": { |
| 402 |
"name": "string.quoted.double.end.prisma" |
| 403 |
} |
| 404 |
}, |
| 405 |
"patterns": [ |
| 406 |
{ |
| 407 |
"include": "#string_interpolation" |
| 408 |
}, |
| 409 |
{ |
| 410 |
"match": "([\\w\\-\\/\\._\\\\%@:\\?=]+)", |
| 411 |
"name": "string.quoted.double.prisma" |
| 412 |
} |
| 413 |
], |
| 414 |
"name": "unnamed" |
| 415 |
}, |
| 416 |
"string_interpolation": { |
| 417 |
"patterns": [ |
| 418 |
{ |
| 419 |
"begin": "\\$\\{", |
| 420 |
"beginCaptures": { |
| 421 |
"0": { |
| 422 |
"name": "keyword.control.interpolation.start.prisma" |
| 423 |
} |
| 424 |
}, |
| 425 |
"end": "\\s*\\}", |
| 426 |
"endCaptures": { |
| 427 |
"0": { |
| 428 |
"name": "keyword.control.interpolation.end.prisma" |
| 429 |
} |
| 430 |
}, |
| 431 |
"name": "source.tag.embedded.source.prisma", |
| 432 |
"patterns": [ |
| 433 |
{ |
| 434 |
"include": "#value" |
| 435 |
} |
| 436 |
] |
| 437 |
} |
| 438 |
] |
| 439 |
} |
| 440 |
} |
| 441 |
} |
| 442 |
|