From 7a0f2d974f9ac5bc85607e8c769d3370dd18ac74 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sat, 7 Dec 2019 12:21:37 +0100 Subject: Update --- after/syntax/tsx.vim | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 after/syntax/tsx.vim (limited to 'after/syntax/tsx.vim') diff --git a/after/syntax/tsx.vim b/after/syntax/tsx.vim new file mode 100644 index 00000000..863da121 --- /dev/null +++ b/after/syntax/tsx.vim @@ -0,0 +1,28 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 + +" GraphQL Support +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,typescriptTemplateSubstitution extend' +exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString' + +" Support expression interpolation ((${...})) inside template strings. +syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=typescriptTemplateSubstitution containedin=graphqlFold keepend + +hi def link graphqlTemplateString typescriptTemplate +hi def link graphqlTemplateExpression typescriptTemplateSubstitution + +syn cluster typescriptExpression add=graphqlTaggedTemplate +syn cluster graphqlTaggedTemplate add=graphqlTemplateString + + +endif -- cgit v1.2.3