robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqvim-patch:16d2854: runtime(graphql): Update syntax script to September 2025 specf0facb8fa4

master
3.9 KiB96 linesraw
1" Vim syntax file
2" Language:	graphql
3" Maintainer:	Jon Parise <jon@indelible.org>
4" Filenames:	*.graphql *.graphqls *.gql
5" URL:		https://github.com/jparise/vim-graphql
6" License:	MIT <https://opensource.org/license/mit>
7" Last Change:	2026 Apr 21
8
9if !exists('main_syntax')
10  if exists('b:current_syntax')
11    finish
12  endif
13  let main_syntax = 'graphql'
14endif
15
16syn case match
17
18syn match graphqlComment    "#.*$" contains=@Spell
19
20syn match graphqlOperator   "=" display
21syn match graphqlOperator   "!" display
22syn match graphqlOperator   "|" display
23syn match graphqlOperator   "&" display
24syn match graphqlOperator   "\M..." display
25
26syn keyword graphqlBoolean  true false
27syn keyword graphqlNull     null
28syn match   graphqlNumber   "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" display
29syn region  graphqlString   start=+"+  skip=+\\\\\|\\"+  end=+"\|$+  contains=graphqlEscape
30syn region  graphqlString   start=+"""+ skip=+\\"""+ end=+"""+  contains=graphqlEscape
31
32syn match   graphqlEscape   +\\["\\/bfnrt]+ contained display
33syn match   graphqlEscape   +\\u\x\{4}+     contained display
34syn match   graphqlEscape   +\\u{\x\+}+     contained display
35syn match   graphqlEscape   +\\""\"+        contained display
36
37syn keyword graphqlKeyword repeatable nextgroup=graphqlKeyword skipwhite
38syn keyword graphqlKeyword on nextgroup=graphqlType,graphqlDirectiveLocation skipwhite
39
40syn keyword graphqlStructure enum scalar type union nextgroup=graphqlType skipwhite
41syn keyword graphqlStructure input interface subscription nextgroup=graphqlType skipwhite
42syn keyword graphqlStructure implements nextgroup=graphqlType skipwhite
43syn keyword graphqlStructure query mutation fragment nextgroup=graphqlName skipwhite
44syn keyword graphqlStructure directive nextgroup=graphqlDirective skipwhite
45syn keyword graphqlStructure extend nextgroup=graphqlStructure skipwhite
46syn keyword graphqlStructure schema nextgroup=graphqlFold skipwhite
47
48syn match graphqlDirective  "\<@\h\w*\>"   display
49syn match graphqlVariable   "\<\$\h\w*\>"  display
50syn match graphqlName       "\<\h\w*\>"    display
51syn match graphqlType       "\<_*\u\w*\>"  display
52
53" https://spec.graphql.org/September2025/#ExecutableDirectiveLocation
54syn keyword graphqlDirectiveLocation QUERY MUTATION SUBSCRIPTION FIELD
55syn keyword graphqlDirectiveLocation FRAGMENT_DEFINITION FRAGMENT_SPREAD
56syn keyword graphqlDirectiveLocation INLINE_FRAGMENT VARIABLE_DEFINITION
57" https://spec.graphql.org/September2025/#TypeSystemDirectiveLocation
58syn keyword graphqlDirectiveLocation SCHEMA SCALAR OBJECT FIELD_DEFINITION
59syn keyword graphqlDirectiveLocation ARGUMENT_DEFINITION INTERFACE UNION
60syn keyword graphqlDirectiveLocation ENUM ENUM_VALUE INPUT_OBJECT
61syn keyword graphqlDirectiveLocation INPUT_FIELD_DEFINITION
62
63syn keyword graphqlMetaFields __schema __type __typename
64
65syn region  graphqlFold matchgroup=graphqlBraces start="{" end="}" transparent fold contains=ALLBUT,graphqlStructure
66syn region  graphqlList matchgroup=graphqlBraces start="\[" end="]" transparent contains=ALLBUT,graphqlDirective,graphqlStructure
67
68if main_syntax ==# 'graphql'
69  syn sync minlines=500
70endif
71
72hi def link graphqlComment          Comment
73hi def link graphqlOperator         Operator
74
75hi def link graphqlBraces           Delimiter
76
77hi def link graphqlBoolean          Boolean
78hi def link graphqlNull             Keyword
79hi def link graphqlNumber           Number
80hi def link graphqlString           String
81hi def link graphqlEscape           Special
82
83hi def link graphqlDirective        PreProc
84hi def link graphqlDirectiveLocation Special
85hi def link graphqlName             Identifier
86hi def link graphqlMetaFields       Special
87hi def link graphqlKeyword          Keyword
88hi def link graphqlStructure        Structure
89hi def link graphqlType             Type
90hi def link graphqlVariable         Identifier
91
92let b:current_syntax = 'graphql'
93
94if main_syntax ==# 'graphql'
95  unlet main_syntax
96endif