summaryrefslogtreecommitdiffstats
path: root/syntax/graphql.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-12-31 14:05:09 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2019-12-31 14:05:09 +0100
commitb8a5504021e0d21310bc603855ac8107828b5759 (patch)
tree2f2bf182b686597e7cc4c4f1b7d35881f9993f55 /syntax/graphql.vim
parentcea0d08a062478503814e51aa21c6486a0dd1b21 (diff)
downloadvim-polyglot-b8a5504021e0d21310bc603855ac8107828b5759.tar.gz
vim-polyglot-b8a5504021e0d21310bc603855ac8107828b5759.zip
Update
Diffstat (limited to 'syntax/graphql.vim')
-rw-r--r--syntax/graphql.vim41
1 files changed, 36 insertions, 5 deletions
diff --git a/syntax/graphql.vim b/syntax/graphql.vim
index 25efe508..9cfac1a6 100644
--- a/syntax/graphql.vim
+++ b/syntax/graphql.vim
@@ -1,6 +1,25 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
-" Vim syntax file
+" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org>
+"
+" Permission is hereby granted, free of charge, to any person obtaining a copy
+" of this software and associated documentation files (the "Software"), to
+" deal in the Software without restriction, including without limitation the
+" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+" sell copies of the Software, and to permit persons to whom the Software is
+" furnished to do so, subject to the following conditions:
+"
+" The above copyright notice and this permission notice shall be included in
+" all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+" IN THE SOFTWARE.
+"
" Language: GraphQL
" Maintainer: Jon Parise <jon@indelible.org>
@@ -8,20 +27,23 @@ if exists('b:current_syntax')
finish
endif
+syn case match
+
syn match graphqlComment "#.*$" contains=@Spell
syn match graphqlOperator "=" display
syn match graphqlOperator "!" display
syn match graphqlOperator "|" display
+syn match graphqlOperator "&" display
syn match graphqlOperator "\M..." display
syn keyword graphqlBoolean true false
syn keyword graphqlNull null
syn match graphqlNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" display
syn region graphqlString start=+"+ skip=+\\\\\|\\"+ end=+"\|$+
-syn region graphqlString start=+"""+ end=+"""+
+syn region graphqlString start=+"""+ skip=+\\"""+ end=+"""+
-syn keyword graphqlKeyword on nextgroup=graphqlType skipwhite
+syn keyword graphqlKeyword on nextgroup=graphqlType,graphqlDirectiveLocation skipwhite
syn keyword graphqlStructure enum scalar type union nextgroup=graphqlType skipwhite
syn keyword graphqlStructure input interface subscription nextgroup=graphqlType skipwhite
@@ -35,7 +57,16 @@ syn match graphqlDirective "\<@\h\w*\>" display
syn match graphqlVariable "\<\$\h\w*\>" display
syn match graphqlName "\<\h\w*\>" display
syn match graphqlType "\<_*\u\w*\>" display
-syn match graphqlConstant "\<[_A-Z][_A-Z0-9]*\>" display
+
+" https://graphql.github.io/graphql-spec/June2018/#ExecutableDirectiveLocation
+syn keyword graphqlDirectiveLocation QUERY MUTATION SUBSCRIPTION FIELD
+syn keyword graphqlDirectiveLocation FRAGMENT_DEFINITION FRAGMENT_SPREAD
+syn keyword graphqlDirectiveLocation INLINE_FRAGMENT
+" https://graphql.github.io/graphql-spec/June2018/#TypeSystemDirectiveLocation
+syn keyword graphqlDirectiveLocation SCHEMA SCALAR OBJECT FIELD_DEFINITION
+syn keyword graphqlDirectiveLocation ARGUMENT_DEFINITION INTERFACE UNION
+syn keyword graphqlDirectiveLocation ENUM ENUM_VALUE INPUT_OBJECT
+syn keyword graphqlDirectiveLocation INPUT_FIELD_DEFINITION
syn keyword graphqlMetaFields __schema __type __typename
@@ -52,8 +83,8 @@ hi def link graphqlNull Keyword
hi def link graphqlNumber Number
hi def link graphqlString String
-hi def link graphqlConstant Constant
hi def link graphqlDirective PreProc
+hi def link graphqlDirectiveLocation Special
hi def link graphqlName Identifier
hi def link graphqlMetaFields Special
hi def link graphqlKeyword Keyword