Skip to content

Commit c180def

Browse files
committed
Add enum highlighting and autocomplete
1 parent 65bbe81 commit c180def

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

GraphQL.sublime-completions

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"scope": "source.graphql",
3+
"completions": [
4+
{ "trigger": "enum", "contents": "enum $1 {\n\t$0\n}"},
5+
{ "trigger": "input", "contents": "input $1 {\n\t$0\n}"},
6+
{ "trigger": "interface", "contents": "interface $1 {\n\t$0\n}"},
7+
{ "trigger": "scalar", "contents": "scalar $0"},
8+
{ "trigger": "schema", "contents": "schema {\n\t$0\n}"},
9+
{ "trigger": "ti", "contents": "type $1 implements $2 {\n\t$0\n}"},
10+
{ "trigger": "type", "contents": "type $1 {\n\t$0\n}"},
11+
{ "trigger": "union", "contents": "union $1 = $0"},
12+
13+
"Boolean",
14+
"Float",
15+
"ID",
16+
"Int",
17+
"mutation",
18+
"query",
19+
"String",
20+
"subscription"
21+
]
22+
}

GraphQL.sublime-syntax

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,19 @@ contexts:
127127

128128
- match: '(?<=enum )\w+\b'
129129
scope: meta.type.enum
130+
push: enums
130131

131132
brackets:
132133
- match: '}'
133134
pop: true
134135
- include: main
135136

137+
enums:
138+
- match: '\w+'
139+
scope: variable.parameter.enum.graphql
140+
- match: '}'
141+
pop: true
142+
136143
parentheses:
137144
- match: '\b\w+(?=\:)'
138145
scope: variable.parameter.arguments.graphql

0 commit comments

Comments
 (0)