Skip to content

Commit 65bbe81

Browse files
committed
Add comment-toggle && types as constants
1 parent 894c1c4 commit 65bbe81

3 files changed

Lines changed: 54 additions & 7 deletions

File tree

Comments.YAML-tmPreferences

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: Comments
2+
scope: source.graphql
3+
settings:
4+
shellVariables:
5+
- name: TM_COMMENT_START
6+
value: '# '

Comments.tmPreferences

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>name</key>
6+
<string>Comments</string>
7+
<key>scope</key>
8+
<string>source.graphql</string>
9+
<key>settings</key>
10+
<dict>
11+
<key>shellVariables</key>
12+
<array>
13+
<dict>
14+
<key>name</key>
15+
<string>TM_COMMENT_START</string>
16+
<key>value</key>
17+
<string># </string>
18+
</dict>
19+
</array>
20+
</dict>
21+
</dict>
22+
</plist>

GraphQL.sublime-syntax

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%YAML 1.2
22
---
33
# See http://www.sublimetext.com/docs/3/syntax.html
4-
name: GraphQL Language
4+
name: GraphQL
55
file_extensions:
66
- graphql
77
- gql
@@ -30,6 +30,9 @@ contexts:
3030
- match: '}'
3131
scope: invalid.illegal.stray-bracket-end
3232

33+
- match: '\)'
34+
scope: invalid.illegal.stray-parentheses-end
35+
3336
# Argument Property
3437
- match: '(?<=\()\w+(?=\:)'
3538
scope: string.property.argument.graphql
@@ -42,6 +45,26 @@ contexts:
4245
- match: '\b\w+(?=\()'
4346
scope: string.property.graphql
4447

48+
# Built-in Scalar Types
49+
- match: '\bID\b'
50+
scope: constant.language.id.graphql
51+
52+
- match: '\bInt\b'
53+
scope: constant.language.int.graphql
54+
55+
- match: '\bString\b'
56+
scope: constant.language.string.graphql
57+
58+
- match: '\bFloat\b'
59+
scope: constant.language.float.graphql
60+
61+
- match: '\bBoolean\b'
62+
scope: constant.language.boolean.graphql
63+
64+
# Numbers
65+
- match: '\b(-)?[0-9.]+\b'
66+
scope: constant.numeric.graphql
67+
4568
# Symbols
4669
- match: '\:'
4770
scope: constant.other.object.key.graphql
@@ -55,7 +78,7 @@ contexts:
5578
- match: '='
5679
scope: keyword.operator.assignment.graphql
5780

58-
# Storage Types
81+
# Type Definitions
5982
- match: '\btype\b'
6083
scope: storage.type.type.graphql
6184

@@ -80,7 +103,7 @@ contexts:
80103
- match: '\benum\b'
81104
scope: storage.type.enum.graphql
82105

83-
# Storage type names
106+
# Type Definition Names
84107
- match: '(?<=type )\w+\b'
85108
scope: meta.type.type
86109

@@ -105,10 +128,6 @@ contexts:
105128
- match: '(?<=enum )\w+\b'
106129
scope: meta.type.enum
107130

108-
# Numbers
109-
- match: '\b(-)?[0-9.]+\b'
110-
scope: constant.numeric.graphql
111-
112131
brackets:
113132
- match: '}'
114133
pop: true

0 commit comments

Comments
 (0)