feat(graphql): graphql support

This commit is contained in:
Nils 2023-04-29 21:12:35 +02:00 committed by Lewis Russell
parent 75b3a0422a
commit 3f33c28f3c
3 changed files with 110 additions and 1 deletions

View file

@ -40,6 +40,7 @@ use 'nvim-treesitter/nvim-treesitter-context'
- [x] `elixir`
- [x] `fish`
- [x] `go`
- [x] `graphql`
- [x] `ini`
- [x] `java`
- [x] `javascript`
@ -109,7 +110,6 @@ use 'nvim-treesitter/nvim-treesitter-context'
- [ ] `gomod`
- [ ] `gosum`
- [ ] `gowork`
- [ ] `graphql`
- [ ] `hack`
- [ ] `haskell`
- [ ] `hcl`

View file

@ -0,0 +1,30 @@
(interface_type_definition
(fields_definition (_) @context.end)
) @context
(object_type_definition
(fields_definition (_) @context.end)
) @context
(schema_definition
(_) @context.end
) @context
(input_object_type_definition
(input_fields_definition (_) @context.end)
) @context
(operation_definition
(selection_set (_) @context.end)
) @context
(inline_fragment
(selection_set (_) @context.end)
) @context
(selection
(field
(arguments)
(selection_set (_) @context.end)
)
) @context

79
test/test.graphql Normal file
View file

@ -0,0 +1,79 @@
interface
Foo
{
id: ID!
name: String
}
input
Stuff {
limit: Int
since_id: ID
}
type Bar
implements Foo {
age: Int
}
type Mutation {
addBar(name: String, age: int): Bar
}
query Stuff {
name
foo {
name
}
}
query GetSearchResults {
search(contains: "Shakespeare") {
__typename
# inline fragment
... on Book {
title
}
... on Author {
name
}
}
}
mutation
CreateBar {
addBar(name: "AAAA",
age: 42) {
name
foo {
age
}
}
}
type Root {
name: String
}
schema {
query: Root
}