Skip to content

Commit 40da77b

Browse files
authored
feature: Add syntax highlighting support for the repeatable keyword on a directive definition. (#3792)
1 parent 487b5ed commit 40da77b

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.changeset/three-lions-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'vscode-graphql-syntax': patch
3+
---
4+
5+
Add syntax highlighting support for the repeatable keyword on a directive definition.

packages/vscode-graphql-syntax/grammars/graphql.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,22 +390,32 @@
390390
"2": {
391391
"name": "entity.name.function.directive.graphql"
392392
},
393-
"3": { "name": "keyword.on.graphql" },
394-
"4": { "name": "support.type.graphql" }
393+
"3": {
394+
"name": "keyword.repeatable.graphql"
395+
},
396+
"4": {
397+
"name": "keyword.on.graphql"
398+
},
399+
"5": {
400+
"name": "support.type.graphql"
401+
}
395402
},
396403
"patterns": [
397404
{
398405
"include": "#graphql-variable-definitions"
399406
},
400407
{
401-
"begin": "\\s*(\\bon\\b)\\s*([_A-Za-z]*)",
408+
"begin": "\\s*(\\brepeatable\\b)?\\s*(\\bon\\b)\\s*([_A-Za-z]*)",
402409
"end": "(?=.)",
403410
"applyEndPatternLast": 1,
404411
"beginCaptures": {
405412
"1": {
406-
"name": "keyword.on.graphql"
413+
"name": "keyword.repeatable.graphql"
407414
},
408415
"2": {
416+
"name": "keyword.on.graphql"
417+
},
418+
"3": {
409419
"name": "support.type.location.graphql"
410420
}
411421
},

packages/vscode-graphql-syntax/tests/__fixtures__/StarWarsSchema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ schema {
55
directive @test(testArg: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
66
directive @onArg on ARGUMENT_DEFINITION
77
directive @onAllDefs on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | UNION | ENUM_VALUE | INPUT_OBJECT | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
8+
directive @onRepeatable repeatable on FIELD_DEFINITION
89

910
enum Episode {
1011
NEWHOPE

packages/vscode-graphql-syntax/tests/__snapshots__/graphql-grammar.spec.ts.snap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,15 @@ INPUT_OBJECT | support.type.location.graphql
329329
ARGUMENT_DEFINITION | support.type.location.graphql
330330
| |
331331
INPUT_FIELD_DEFINITION | support.type.location.graphql
332+
directive | keyword.directive.graphql
333+
|
334+
@onRepeatable | entity.name.function.directive.graphql
335+
|
336+
repeatable | keyword.repeatable.graphql
337+
|
338+
on | keyword.on.graphql
339+
|
340+
FIELD_DEFINITION | support.type.location.graphql
332341
|
333342
enum | meta.enum.graphql keyword.enum.graphql
334343
| meta.enum.graphql

0 commit comments

Comments
 (0)