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