|
| 1 | +# [PackageDev] target_format: plist, ext: tmLanguage |
| 2 | +name: GraphQL |
| 3 | +scopeName: source.graphql |
| 4 | +fileTypes: [graphql, GraphQL] |
| 5 | + |
| 6 | +patterns: |
| 7 | +- include: '#comment' |
| 8 | + |
| 9 | +- comment: a fragment definintion |
| 10 | + name: meta.fragment |
| 11 | + match: (fragment)\s*([_A-Za-z][_0-9A-Za-z]*)\s*(on)\s*([_A-Za-z][_0-9A-Za-z]*) |
| 12 | + captures: |
| 13 | + '1': {name: storage.type} |
| 14 | + '2': {name: variable.other} |
| 15 | + '3': {name: keyword.operator} |
| 16 | + '4': {name: support.constant} |
| 17 | + |
| 18 | +- comment: an operation definition |
| 19 | + name: meta.operation |
| 20 | + match: (query|mutation)\s*([_A-Za-z][_0-9A-Za-z]*) |
| 21 | + captures: |
| 22 | + '1': {name: storage.type} |
| 23 | + '2': {name: variable.other} |
| 24 | + |
| 25 | +- include: '#arguments' |
| 26 | + |
| 27 | +- include: '#selections' |
| 28 | + |
| 29 | +repository: |
| 30 | + comment: |
| 31 | + name: comment.line.number-sign.graphql |
| 32 | + match: '#.*$' |
| 33 | + |
| 34 | + argument: |
| 35 | + name: variable.parameter |
| 36 | + match: '[_A-Za-z][_0-9A-Za-z]*:' |
| 37 | + |
| 38 | + arguments: |
| 39 | + name: meta.arguments |
| 40 | + begin: \( |
| 41 | + beginCaptures: |
| 42 | + '0': {name: meta.brace.round.graphql} |
| 43 | + end: \) |
| 44 | + endCaptures: |
| 45 | + '0': {name: meta.brace.round.graphql} |
| 46 | + patterns: |
| 47 | + - include: '#argument' |
| 48 | + - include: '#string' |
| 49 | + - include: '#boolean' |
| 50 | + - include: '#variable' |
| 51 | + - include: '#number' |
| 52 | + - include: '#enum' |
| 53 | + - include: '#comment' |
| 54 | + |
| 55 | + boolean: |
| 56 | + name: constant.language.boolean |
| 57 | + match: true|false |
| 58 | + |
| 59 | + builtInField: |
| 60 | + name: keyword.other.graphql |
| 61 | + match: __schema|__typename|__type |
| 62 | + |
| 63 | + directive: |
| 64 | + name: storage.modifier |
| 65 | + match: '@[a-z]+' |
| 66 | + |
| 67 | + enum: |
| 68 | + name: support.constant.enum |
| 69 | + match: '[_A-Za-z][_0-9A-Za-z]*' |
| 70 | + |
| 71 | + escapedChar: |
| 72 | + name: constant.character.escape.graphql |
| 73 | + match: \\(?:u[\da-fA-f]{4}|.) |
| 74 | + |
| 75 | + fieldAlias: |
| 76 | + name: variable.other.alias.graphql |
| 77 | + match: '[_A-Za-z][_0-9A-Za-z]*:' |
| 78 | + |
| 79 | + fragmentSpread: |
| 80 | + match: (\.\.\.)\s*([_A-Za-z][_0-9A-Za-z]*)\s*(on)? |
| 81 | + captures: |
| 82 | + '1': {name: keyword.operator} |
| 83 | + '2': {name: variable.other} |
| 84 | + |
| 85 | + inlineFragment: |
| 86 | + match: (\.\.\.)\s*(on)\s*([_A-Za-z][_0-9A-Za-z]*) |
| 87 | + captures: |
| 88 | + '1': {name: keyword.operator} |
| 89 | + '2': {name: keyword.operator} |
| 90 | + '3': {name: support.constant} |
| 91 | + |
| 92 | + number: |
| 93 | + name: constant.numeric |
| 94 | + match: \d+\.?\d*[eE]?[\+\-]?\d* |
| 95 | + |
| 96 | + selections: |
| 97 | + name: meta.selections |
| 98 | + begin: \{ |
| 99 | + beginCaptures: |
| 100 | + '0': {name: meta.brace.curly.graphql} |
| 101 | + end: \} |
| 102 | + endCaptures: |
| 103 | + '0': {name: meta.brace.curly.graphql} |
| 104 | + patterns: |
| 105 | + - include: '#fieldAlias' |
| 106 | + - include: '#inlineFragment' |
| 107 | + - include: '#fragmentSpread' |
| 108 | + - include: '#directive' |
| 109 | + - include: '#arguments' |
| 110 | + - include: '#comment' |
| 111 | + - include: '#selections' |
| 112 | + - include: '#builtInField' |
| 113 | + |
| 114 | + string: |
| 115 | + name: string.quoted.double |
| 116 | + begin: '"' |
| 117 | + beginCaptures: |
| 118 | + '0': {name: punctuation.definition.string.begin} |
| 119 | + end: '"' |
| 120 | + endCaptures: |
| 121 | + '0': {name: punctuation.definition.string.end} |
| 122 | + patterns: |
| 123 | + - include: '#escapedChar' |
| 124 | + |
| 125 | + variable: |
| 126 | + name: constant.other.symbol |
| 127 | + match: \$[_A-Za-z][_0-9A-Za-z]* |
| 128 | +foldingStartMarker: '{([' |
| 129 | +foldingStopMarker: '})]' |
0 commit comments