aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/graphql
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/graphql
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/graphql')
-rw-r--r--runtime/queries/graphql/highlights.scm163
-rw-r--r--runtime/queries/graphql/indents.scm11
-rw-r--r--runtime/queries/graphql/injections.scm2
3 files changed, 176 insertions, 0 deletions
diff --git a/runtime/queries/graphql/highlights.scm b/runtime/queries/graphql/highlights.scm
new file mode 100644
index 000000000..c1ee501c4
--- /dev/null
+++ b/runtime/queries/graphql/highlights.scm
@@ -0,0 +1,163 @@
+; Types
+;------
+(scalar_type_definition
+ (name) @type)
+
+(object_type_definition
+ (name) @type)
+
+(interface_type_definition
+ (name) @type)
+
+(union_type_definition
+ (name) @type)
+
+(enum_type_definition
+ (name) @type)
+
+(input_object_type_definition
+ (name) @type)
+
+(scalar_type_extension
+ (name) @type)
+
+(object_type_extension
+ (name) @type)
+
+(interface_type_extension
+ (name) @type)
+
+(union_type_extension
+ (name) @type)
+
+(enum_type_extension
+ (name) @type)
+
+(input_object_type_extension
+ (name) @type)
+
+(named_type
+ (name) @type)
+
+; Directives
+;-----------
+(directive_definition
+ "@" @attribute
+ (name) @attribute)
+
+(directive) @attribute
+
+; Properties
+;-----------
+(field
+ (name) @property)
+
+(field
+ (alias
+ (name) @property))
+
+(field_definition
+ (name) @property)
+
+(object_value
+ (object_field
+ (name) @property))
+
+(enum_value
+ (name) @property)
+
+; Variable Definitions and Arguments
+;-----------------------------------
+(operation_definition
+ (name) @variable)
+
+(fragment_name
+ (name) @variable)
+
+(input_fields_definition
+ (input_value_definition
+ (name) @variable.parameter))
+
+(argument
+ (name) @variable.parameter)
+
+(arguments_definition
+ (input_value_definition
+ (name) @variable.parameter))
+
+(variable_definition
+ (variable) @variable.parameter)
+
+(argument
+ (value
+ (variable) @variable))
+
+; Constants
+;----------
+(string_value) @string
+
+(int_value) @number
+
+(float_value) @number.float
+
+(boolean_value) @boolean
+
+; Literals
+;---------
+(description
+ (string_value) @string.documentation @spell)
+
+(comment) @comment @spell
+
+(directive_location
+ (executable_directive_location) @type.builtin)
+
+(directive_location
+ (type_system_directive_location) @type.builtin)
+
+; Keywords
+;----------
+[
+ "query"
+ "mutation"
+ "subscription"
+ "fragment"
+ "scalar"
+ "input"
+ "extend"
+ "directive"
+ "schema"
+ "on"
+ "repeatable"
+ "implements"
+] @keyword
+
+[
+ "enum"
+ "union"
+ "type"
+ "interface"
+] @keyword.type
+
+; Punctuation
+;------------
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+"=" @operator
+
+"|" @punctuation.delimiter
+
+"&" @punctuation.delimiter
+
+":" @punctuation.delimiter
+
+"..." @punctuation.special
+
+"!" @punctuation.special
diff --git a/runtime/queries/graphql/indents.scm b/runtime/queries/graphql/indents.scm
new file mode 100644
index 000000000..fcffeb822
--- /dev/null
+++ b/runtime/queries/graphql/indents.scm
@@ -0,0 +1,11 @@
+[
+ (definition)
+ (selection)
+] @indent.begin
+
+[
+ "{"
+ "}"
+] @indent.branch
+
+"}" @indent.end
diff --git a/runtime/queries/graphql/injections.scm b/runtime/queries/graphql/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/runtime/queries/graphql/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))