Skip to content

Commit 895092a

Browse files
authored
feat: Add GraphQL support (#1154)
* feat: Add GraphQL support * chore: Register to graphql-mode
1 parent 3d22dcd commit 895092a

File tree

6 files changed

+173
-0
lines changed

6 files changed

+173
-0
lines changed

.github/workflows/update-grammars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
- glsl
5656
- go
5757
- gpr
58+
- graphql
5859
- groovy
5960
- haskell
6061
- haxe

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,3 +630,9 @@
630630
update = none
631631
ignore = dirty
632632
branch = master
633+
[submodule "repos/graphql"]
634+
path = repos/graphql
635+
url = https://github.com/bkegley/tree-sitter-graphql
636+
update = none
637+
ignore = dirty
638+
branch = master

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## Unreleased
4+
- Add `GraphQL` support
45

56
## 0.12.301 - 2025-08-24
67

queries/graphql/highlights.scm

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
; Types
2+
;------
3+
(scalar_type_definition
4+
(name) @type)
5+
6+
(object_type_definition
7+
(name) @type)
8+
9+
(interface_type_definition
10+
(name) @type)
11+
12+
(union_type_definition
13+
(name) @type)
14+
15+
(enum_type_definition
16+
(name) @type)
17+
18+
(input_object_type_definition
19+
(name) @type)
20+
21+
(scalar_type_extension
22+
(name) @type)
23+
24+
(object_type_extension
25+
(name) @type)
26+
27+
(interface_type_extension
28+
(name) @type)
29+
30+
(union_type_extension
31+
(name) @type)
32+
33+
(enum_type_extension
34+
(name) @type)
35+
36+
(input_object_type_extension
37+
(name) @type)
38+
39+
(named_type
40+
(name) @type)
41+
42+
; Directives
43+
;-----------
44+
(directive_definition
45+
"@" @attribute
46+
(name) @attribute)
47+
48+
(directive) @attribute
49+
50+
; Properties
51+
;-----------
52+
(field
53+
(name) @property)
54+
55+
(field
56+
(alias
57+
(name) @property))
58+
59+
(field_definition
60+
(name) @property)
61+
62+
(object_value
63+
(object_field
64+
(name) @property))
65+
66+
(enum_value
67+
(name) @property)
68+
69+
; Variable Definitions and Arguments
70+
;-----------------------------------
71+
(operation_definition
72+
(name) @variable)
73+
74+
(fragment_name
75+
(name) @variable)
76+
77+
(input_fields_definition
78+
(input_value_definition
79+
(name) @variable.parameter))
80+
81+
(argument
82+
(name) @variable.parameter)
83+
84+
(arguments_definition
85+
(input_value_definition
86+
(name) @variable.parameter))
87+
88+
(variable_definition
89+
(variable) @variable.parameter)
90+
91+
(argument
92+
(value
93+
(variable) @variable))
94+
95+
; Constants
96+
;----------
97+
(string_value) @string
98+
99+
(int_value) @number
100+
101+
(float_value) @number.float
102+
103+
(boolean_value) @boolean
104+
105+
; Literals
106+
;---------
107+
(description
108+
(string_value) @string.documentation @spell)
109+
110+
(comment) @comment @spell
111+
112+
(directive_location
113+
(executable_directive_location) @type.builtin)
114+
115+
(directive_location
116+
(type_system_directive_location) @type.builtin)
117+
118+
; Keywords
119+
;----------
120+
[
121+
"query"
122+
"mutation"
123+
"subscription"
124+
"fragment"
125+
"scalar"
126+
"input"
127+
"extend"
128+
"directive"
129+
"schema"
130+
"on"
131+
"repeatable"
132+
"implements"
133+
] @keyword
134+
135+
[
136+
"enum"
137+
"union"
138+
"type"
139+
"interface"
140+
] @keyword.type
141+
142+
; Punctuation
143+
;------------
144+
[
145+
"("
146+
")"
147+
"["
148+
"]"
149+
"{"
150+
"}"
151+
] @punctuation.bracket
152+
153+
"=" @operator
154+
155+
"|" @punctuation.delimiter
156+
157+
"&" @punctuation.delimiter
158+
159+
":" @punctuation.delimiter
160+
161+
"..." @punctuation.special
162+
163+
"!" @punctuation.special

repos/graphql

Submodule graphql added at 5e66e96

tree-sitter-langs.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ See `tree-sitter-langs-repos'."
143143
(glsl-mode . glsl)
144144
(go-mode . go)
145145
(gpr-mode . gpr)
146+
(graphql-mode . graphql)
146147
(groovy-mode . groovy)
147148
(jenkinsfile-mode . groovy)
148149
(haskell-mode . haskell)

0 commit comments

Comments
 (0)