Skip to content

Only set 'syn-sync' when it is the main syntax #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions after/syntax/javascript/graphql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ if exists('b:current_syntax')
let s:current_syntax = b:current_syntax
unlet b:current_syntax
endif

let b:graphql_nested_syntax = 1
syn include @GraphQLSyntax syntax/graphql.vim
unlet b:graphql_nested_syntax

if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif
Expand Down
4 changes: 4 additions & 0 deletions after/syntax/php/graphql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ if exists('b:current_syntax')
let s:current_syntax = b:current_syntax
unlet b:current_syntax
endif

let b:graphql_nested_syntax = 1
syn include @GraphQLSyntax syntax/graphql.vim
unlet b:graphql_nested_syntax

if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif
Expand Down
4 changes: 4 additions & 0 deletions after/syntax/reason/graphql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ if exists('b:current_syntax')
let s:current_syntax = b:current_syntax
unlet b:current_syntax
endif

let b:graphql_nested_syntax = 1
syn include @GraphQLSyntax syntax/graphql.vim
unlet b:graphql_nested_syntax

if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif
Expand Down
4 changes: 4 additions & 0 deletions after/syntax/typescript/graphql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ if exists('b:current_syntax')
let s:current_syntax = b:current_syntax
unlet b:current_syntax
endif

let b:graphql_nested_syntax = 1
syn include @GraphQLSyntax syntax/graphql.vim
unlet b:graphql_nested_syntax

if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif
Expand Down
4 changes: 3 additions & 1 deletion syntax/graphql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ hi def link graphqlStructure Structure
hi def link graphqlType Type
hi def link graphqlVariable Identifier

syn sync minlines=500
if !get(b:, 'graphql_nested_syntax')
syn sync minlines=500
endif

let b:current_syntax = 'graphql'
5 changes: 5 additions & 0 deletions test/php/default.vader
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ Given php (Nowdoc):
Execute (Syntax assertions):
AssertEqual 'Delimiter', SyntaxOf('GQL')
AssertEqual 'graphqlName', SyntaxOf('user')

Execute (Settings assertions):
redir @a | syntax sync | redir END
let match = match(@a, 'syncing starts 500 lines before top line') >= 0
Assert !match, "'syntax sync minlines' was changed in outer syntax"