summaryrefslogtreecommitdiffstats
path: root/after/syntax/javascript/graphql.vim
diff options
context:
space:
mode:
authorDan Reif <dan.reif@collectivehealth.com>2018-05-08 10:28:33 -0700
committerDan Reif <dan.reif@collectivehealth.com>2018-05-08 10:28:33 -0700
commite2404449e4f961c5e6c0e2689078612b36d776c2 (patch)
tree5e6dc545006d2beeeea37395d56a87f6d02e8a51 /after/syntax/javascript/graphql.vim
parentdc8b2f45deb7e0d139f1fe01881faa1b676d043f (diff)
downloadvim-polyglot-e2404449e4f961c5e6c0e2689078612b36d776c2.tar.gz
vim-polyglot-e2404449e4f961c5e6c0e2689078612b36d776c2.zip
Merge pull request #301 from timfeirg:feature/graphql
Diffstat (limited to 'after/syntax/javascript/graphql.vim')
-rw-r--r--after/syntax/javascript/graphql.vim21
1 files changed, 21 insertions, 0 deletions
diff --git a/after/syntax/javascript/graphql.vim b/after/syntax/javascript/graphql.vim
new file mode 100644
index 00000000..58c1de08
--- /dev/null
+++ b/after/syntax/javascript/graphql.vim
@@ -0,0 +1,21 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+
+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
+
+syntax region graphqlTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend
+exec 'syntax match graphqlTaggedTemplate +\%(' . join(g:graphql_javascript_tags, '\|') . '\)\%(`\)\@=+ nextgroup=graphqlTemplateString'
+
+hi def link graphqlTemplateString jsTemplateString
+hi def link graphqlTaggedTemplate jsTaggedTemplate
+
+syn cluster jsExpression add=graphqlTaggedTemplate
+syn cluster graphqlTaggedTemplate add=graphqlTemplateString
+
+endif