Skip to content

Commit afb8605

Browse files
committed
Fix operation field args.
1 parent cfc0af0 commit afb8605

2 files changed

Lines changed: 88 additions & 72 deletions

File tree

GraphQL.sublime-syntax

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,11 @@ contexts:
309309
scope: punctuation.section.block.end.graphql
310310
pop: true
311311
- match: '{{name}}'
312-
scope: variable.parameter.graphql
312+
scope: entity.name.field.graphql
313313
push:
314314
- selection-set
315315
- directives
316-
- variable-definitions
316+
- field-arguments
317317
- aliased-field-name
318318
- include: else-pop
319319

@@ -327,6 +327,22 @@ contexts:
327327
- include: else-pop
328328
- include: else-pop
329329

330+
field-arguments:
331+
- match: \(
332+
scope: punctuation.section.group.begin.graphql
333+
set:
334+
- match: \)
335+
scope: punctuation.section.group.end.graphql
336+
pop: true
337+
- match: '{{name}}'
338+
scope: variable.parameter.graphql
339+
push:
340+
- - match: ':'
341+
scope: punctuation.separator.type.graphql
342+
set: value
343+
- include: else-pop
344+
- include: else-pop
345+
330346
schema-definition:
331347
- match: \{
332348
scope: punctuation.section.block.begin.graphql

tests/syntax_test_graphql.gql

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
# ^ punctuation.section.block.begin
8888

8989
myAlias : myField ( )
90-
# ^^^^^^^ variable.parameter
90+
# ^^^^^^^ entity.name.field
9191
# ^ meta.block punctuation.separator.key-value
9292
# ^^^^^^^ meta.block variable.parameter
9393
# ^ meta.block punctuation.section.group.begin
@@ -102,88 +102,88 @@
102102
# ^ punctuation.section.block.end
103103

104104
myField(
105-
$var = $myVar
106-
# ^ punctuation.definition.variable
107-
# ^^^^^ variable.other
108-
$zero = 0
109-
# ^ constant.numeric.integer
110-
$int = 123
111-
# ^^^ constant.numeric.integer
112-
$frac = 123.45
113-
# ^^^^^^ constant.numeric.float
114-
$exp1 = 123e+1
115-
# ^^^^^^ constant.numeric.float
116-
$exp2 = 123e-1
117-
# ^^^^^^ constant.numeric.float
118-
$exp3 = 123E1
119-
# ^^^^^ constant.numeric.float
120-
$expf = 123.45e1
121-
# ^^^^^^^^ constant.numeric.float
122-
$null = null
123-
# ^^^^ constant.language.null
124-
$true = true
125-
# ^^^^ constant.language.boolean.true
126-
$false= false
127-
# ^^^^^ constant.language.boolean.false
128-
$enum = myVal
129-
# ^^^^^ constant.other
130-
$str = "foo!"
131-
# ^ punctuation.definition.string.begin
132-
# ^^^^^^ string.quoted.double
133-
# ^ punctuation.definition.string.end
134-
$str2 = "\u12345"
135-
# ^^^^^^ constant.character.escape.hex
136-
# ^^ - constant
137-
$str3 = "\u123"
138-
# ^^^^^ invalid.illegal.escape
139-
$str4 = "\"\\\/\b\f\n\r\t"
140-
# ^^^^^^^^^^^^^^^^ constant.character.escape
141-
$str5 = "\0\a"
142-
# ^^^^ invalid.illegal.escape
143-
$str6 = "foo
105+
var : $myVar
106+
# ^ punctuation.definition.variable
107+
# ^^^^^ variable.other
108+
zero : 0
109+
# ^ constant.numeric.integer
110+
int : 123
111+
# ^^^ constant.numeric.integer
112+
frac : 123.45
113+
# ^^^^^^ constant.numeric.float
114+
exp1 : 123e+1
115+
# ^^^^^^ constant.numeric.float
116+
exp2 : 123e-1
117+
# ^^^^^^ constant.numeric.float
118+
exp3 : 123E1
119+
# ^^^^^ constant.numeric.float
120+
expf : 123.45e1
121+
# ^^^^^^^^ constant.numeric.float
122+
null : null
123+
# ^^^^ constant.language.null
124+
true : true
125+
# ^^^^ constant.language.boolean.true
126+
false: false
127+
# ^^^^^ constant.language.boolean.false
128+
enum : myVal
129+
# ^^^^^ constant.other
130+
str : "foo!"
131+
# ^ punctuation.definition.string.begin
132+
# ^^^^^^ string.quoted.double
133+
# ^ punctuation.definition.string.end
134+
str2 : "\u12345"
135+
# ^^^^^^ constant.character.escape.hex
136+
# ^^ - constant
137+
str3 : "\u123"
138+
# ^^^^^ invalid.illegal.escape
139+
str4 : "\"\\\/\b\f\n\r\t"
140+
# ^^^^^^^^^^^^^^^^ constant.character.escape
141+
str5 : "\0\a"
142+
# ^^^^ invalid.illegal.escape
143+
str6 : "foo
144144
# ^^^^^ string.quoted.double
145145
# not a comment
146146
# ^^^^^^^^^^^^^^^ string - comment
147147
bar"
148148
# ^^^^ string.quoted.double
149-
$str7 = """foo"""
150-
# ^^^^^^^^^ string.quoted.triple
151-
# ^^^ punctuation.definition.string.begin
152-
# ^^^ punctuation.definition.string.end
153-
$str8 = """foo
154-
# ^^^^^^^^^ string.quoted.triple
149+
str7 : """foo"""
150+
# ^^^^^^^^^ string.quoted.triple
151+
# ^^^ punctuation.definition.string.begin
152+
# ^^^ punctuation.definition.string.end
153+
str8 : """foo
154+
# ^^^^^^^^^ string.quoted.triple
155155
# not a comment
156156
# ^^^^^^^^^^^^^^^ string - comment
157157
\"""
158158
# ^^^^ constant.character.escape
159159
bar"""
160160
# ^^^^^^ string.quoted.triple
161161
162-
$arr1 = []
163-
# ^^ meta.sequence
164-
# ^ punctuation.section.sequence.begin
165-
# ^ punctuation.section.sequence.end
166-
$arr2 = [ 1 2 3 ]
167-
# ^^^^^^^^^ meta.sequence
168-
# ^ punctuation.section.sequence.begin
169-
# ^ constant.numeric.integer
170-
# ^ constant.numeric.integer
162+
arr1 : []
163+
# ^^ meta.sequence
164+
# ^ punctuation.section.sequence.begin
165+
# ^ punctuation.section.sequence.end
166+
arr2 : [ 1 2 3 ]
167+
# ^^^^^^^^^ meta.sequence
168+
# ^ punctuation.section.sequence.begin
169+
# ^ constant.numeric.integer
170+
# ^ constant.numeric.integer
171+
# ^ constant.numeric.integer
172+
# ^ punctuation.section.sequence.end
173+
obj1 : {}
174+
# ^^ meta.mapping
175+
# ^ punctuation.section.mapping.begin
176+
# ^ punctuation.section.mapping.end
177+
obj2 : { foo: 1 bar: baz }
178+
# ^^^^^^^^^^^^^^^^^^^ meta.mapping
179+
# ^ punctuation.section.mapping.begin
180+
# ^^^ meta.mapping.key
181+
# ^ punctuation.separator.key-value
171182
# ^ constant.numeric.integer
172-
# ^ punctuation.section.sequence.end
173-
$obj1 = {}
174-
# ^^ meta.mapping
175-
# ^ punctuation.section.mapping.begin
176-
# ^ punctuation.section.mapping.end
177-
$obj2 = { foo: 1 bar: baz }
178-
# ^^^^^^^^^^^^^^^^^^^ meta.mapping
179-
# ^ punctuation.section.mapping.begin
180-
# ^^^ meta.mapping.key
181-
# ^ punctuation.separator.key-value
182-
# ^ constant.numeric.integer
183-
# ^^^ meta.mapping.key
184-
# ^ punctuation.separator.key-value
185-
# ^^^ constant.other
186-
# ^ punctuation.section.mapping.end
183+
# ^^^ meta.mapping.key
184+
# ^ punctuation.separator.key-value
185+
# ^^^ constant.other
186+
# ^ punctuation.section.mapping.end
187187
)
188188
189189
}

0 commit comments

Comments
 (0)