From 9d07139d4392b7419572fd45fe650a0414a7ed29 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Tue, 1 Dec 2020 14:22:19 -0800 Subject: [PATCH] Only set 'syn-sync' when we're the main syntax This should avoid problems when the GraphQL syntax is embedded within an outer syntax. In those cases, we don't want to change the syntax sync setting. --- syntax/graphql.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/syntax/graphql.vim b/syntax/graphql.vim index ae0bce8..703a118 100644 --- a/syntax/graphql.vim +++ b/syntax/graphql.vim @@ -21,7 +21,12 @@ " Language: GraphQL " Maintainer: Jon Parise -if exists('b:current_syntax') +if !exists('main_syntax') + if exists('b:current_syntax') + finish + endif + let main_syntax = 'graphql' +elseif exists('b:current_syntax') && b:current_syntax ==# 'graphql' finish endif @@ -90,6 +95,11 @@ hi def link graphqlStructure Structure hi def link graphqlType Type hi def link graphqlVariable Identifier -syn sync minlines=500 +if main_syntax ==# 'graphql' + syn sync minlines=500 +endif let b:current_syntax = 'graphql' +if main_syntax ==# 'graphql' + unlet main_syntax +endif