Skip to content

Commit

Permalink
Add support for GraphQL empty types and extend keyword.
Browse files Browse the repository at this point in the history
Closes #471
Closes #472
  • Loading branch information
sthub1 committed Jan 24, 2018
1 parent d6ddb84 commit 9f8fa42
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
13 changes: 9 additions & 4 deletions grammars/Babel Language.json
Original file line number Diff line number Diff line change
Expand Up @@ -3589,9 +3589,10 @@
},
"graphql-type-interface": {
"name": "meta.type.interface.graphql",
"begin": "\\s*\\b(?:(extends)?\\b\\s*\\b(type)|(interface)|(input))\\b\\s*([_A-Za-z][_0-9A-Za-z]*)?",
"end": "(?<=})",
"captures": {
"begin": "\\s*\\b(?:(extends?)?\\b\\s*\\b(type)|(interface)|(input))\\b\\s*([_A-Za-z][_0-9A-Za-z]*)?",
"end": "(?=.)",
"applyEndPatternLast": 1,
"beginCaptures": {
"1": { "name": "keyword.type.graphql"},
"2": { "name": "keyword.type.graphql"},
"3": { "name": "keyword.interface.graphql"},
Expand All @@ -3608,9 +3609,13 @@
},
{ "include": "#graphql-comment" },
{ "include": "#graphql-type-object" },
{ "include": "#literal-quasi-embedded" }
{ "include": "#literal-quasi-embedded" },
{ "include": "#graphql-ignore-spaces" }
]
},
"graphql-ignore-spaces": {
"match": "\\s*"
},
"graphql-type-object": {
"name": "meta.type.object.graphql",
"begin": "\\s*({)",
Expand Down
14 changes: 14 additions & 0 deletions spec/fixtures/grammar/graphql.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
## SYNTAX TEST "source.js.jsx"

var schema = buildSchema(/* GraphQL */`
type Query
##^^^^ ^^^^^ meta.function-call.with-arguments.js
##^^^^ ^^^^^ meta.type.interface.graphql
##^^^^ keyword.type.graphql
## ^^^^^ support.type.graphql
extend type Query {
##^^^^^^ ^^^^ ^^^^^ ^ meta.function-call.with-arguments.js
##^^^^^^ ^^^^ ^^^^^ ^ meta.type.interface.graphql
##^^^^^^ ^^^^ keyword.type.graphql
## ^^^^^ support.type.graphql
## ^ meta.type.object.graphql
## ^ punctuation.operation.graphql
myField: String!
}
type Query {
hello: String
}
Expand Down

0 comments on commit 9f8fa42

Please sign in to comment.