blob: edc8eea116ea67528f312fe518b81f94f2eb0fad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'graphql') != -1
finish
endif
if exists('b:current_syntax')
let s:current_syntax = b:current_syntax
unlet b:current_syntax
endif
syn include @GraphQLSyntax syntax/graphql.vim
if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif
let s:tags = '\%(' . join(graphql#javascript_tags(), '\|') . '\)'
exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\`+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend'
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
" Support expression interpolation ((${...})) inside template strings.
syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=jsTemplateExpression containedin=graphqlFold keepend
hi def link graphqlTemplateString jsTemplateString
hi def link graphqlTaggedTemplate jsTaggedTemplate
hi def link graphqlTemplateExpression jsTemplateExpression
syn cluster jsExpression add=graphqlTaggedTemplate
syn cluster graphqlTaggedTemplate add=graphqlTemplateString
|