Skip to content

Commit

Permalink
feature: Add syntax highlighting support for the repeatable keyword o…
Browse files Browse the repository at this point in the history
…n a directive definition. (#3792)
  • Loading branch information
idosela authored Nov 2, 2024
1 parent 487b5ed commit 40da77b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-lions-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'vscode-graphql-syntax': patch
---

Add syntax highlighting support for the repeatable keyword on a directive definition.
18 changes: 14 additions & 4 deletions packages/vscode-graphql-syntax/grammars/graphql.json
Original file line number Diff line number Diff line change
Expand Up @@ -390,22 +390,32 @@
"2": {
"name": "entity.name.function.directive.graphql"
},
"3": { "name": "keyword.on.graphql" },
"4": { "name": "support.type.graphql" }
"3": {
"name": "keyword.repeatable.graphql"
},
"4": {
"name": "keyword.on.graphql"
},
"5": {
"name": "support.type.graphql"
}
},
"patterns": [
{
"include": "#graphql-variable-definitions"
},
{
"begin": "\\s*(\\bon\\b)\\s*([_A-Za-z]*)",
"begin": "\\s*(\\brepeatable\\b)?\\s*(\\bon\\b)\\s*([_A-Za-z]*)",
"end": "(?=.)",
"applyEndPatternLast": 1,
"beginCaptures": {
"1": {
"name": "keyword.on.graphql"
"name": "keyword.repeatable.graphql"
},
"2": {
"name": "keyword.on.graphql"
},
"3": {
"name": "support.type.location.graphql"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ schema {
directive @test(testArg: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @onArg on ARGUMENT_DEFINITION
directive @onAllDefs on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | UNION | ENUM_VALUE | INPUT_OBJECT | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
directive @onRepeatable repeatable on FIELD_DEFINITION

enum Episode {
NEWHOPE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,15 @@ INPUT_OBJECT | support.type.location.graphql
ARGUMENT_DEFINITION | support.type.location.graphql
| |
INPUT_FIELD_DEFINITION | support.type.location.graphql
directive | keyword.directive.graphql
|
@onRepeatable | entity.name.function.directive.graphql
|
repeatable | keyword.repeatable.graphql
|
on | keyword.on.graphql
|
FIELD_DEFINITION | support.type.location.graphql
|
enum | meta.enum.graphql keyword.enum.graphql
| meta.enum.graphql
Expand Down

0 comments on commit 40da77b

Please sign in to comment.