summaryrefslogtreecommitdiffstats
path: root/after/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'after/syntax')
-rw-r--r--after/syntax/javascript.vim56
-rw-r--r--after/syntax/javascriptreact.vim2
-rw-r--r--after/syntax/jsx.vim59
-rw-r--r--after/syntax/reason/graphql.vim2
4 files changed, 64 insertions, 55 deletions
diff --git a/after/syntax/javascript.vim b/after/syntax/javascript.vim
index 00c4b079..2992e942 100644
--- a/after/syntax/javascript.vim
+++ b/after/syntax/javascript.vim
@@ -1,59 +1,9 @@
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Vim syntax file
-"
-" Language: javascript.jsx
-" Maintainer: MaxMellon <maxmellon1994@gmail.com>
-"
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-let s:jsx_cpo = &cpo
-set cpo&vim
-
-syntax case match
-
-if exists('b:current_syntax')
- let s:current_syntax = b:current_syntax
- unlet b:current_syntax
-endif
-
-if exists('s:current_syntax')
- let b:current_syntax = s:current_syntax
-endif
-
-if hlexists("jsDebugger") || hlexists("jsNoise") " yuezk/vim-js or pangloss/vim-javascript
- syntax cluster jsExpression add=jsxRegion
-elseif hlexists("javascriptOpSymbols") " othree/yajs.vim
- " refine the javascript line comment
- syntax region javascriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
- syntax cluster javascriptValue add=jsxRegion
- syntax cluster javascriptNoReserved add=jsxElement,jsxTag
-else " build-in javascript syntax
- " refine the javascript line comment
- syntax region javaScriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
-
- " refine the template string syntax
- syntax region javaScriptEmbed matchgroup=javaScriptEmbedBraces start=+\${+ end=+}+ contained contains=@javaScriptEmbededExpr
-
- " add a javaScriptBlock group for build-in syntax
- syntax region javaScriptBlock
- \ matchgroup=javaScriptBraces
- \ start="{"
- \ end="}"
- \ contained
- \ extend
- \ contains=javaScriptBlock,@javaScriptEmbededExpr,javaScript.*
- \ fold
-
- syntax cluster javaScriptEmbededExpr add=jsxRegion,javaScript.*
+if get(g:, 'vim_jsx_pretty_disable_js', 0)
+ finish
endif
-runtime syntax/jsx_pretty.vim
-
-let b:current_syntax = 'javascript.jsx'
-
-let &cpo = s:jsx_cpo
-unlet s:jsx_cpo
+source <sfile>:h/jsx.vim
endif
diff --git a/after/syntax/javascriptreact.vim b/after/syntax/javascriptreact.vim
index ab847072..265415d0 100644
--- a/after/syntax/javascriptreact.vim
+++ b/after/syntax/javascriptreact.vim
@@ -1,5 +1,5 @@
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
-source <sfile>:h/javascript.vim
+source <sfile>:h/jsx.vim
endif
diff --git a/after/syntax/jsx.vim b/after/syntax/jsx.vim
new file mode 100644
index 00000000..00c4b079
--- /dev/null
+++ b/after/syntax/jsx.vim
@@ -0,0 +1,59 @@
+if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Vim syntax file
+"
+" Language: javascript.jsx
+" Maintainer: MaxMellon <maxmellon1994@gmail.com>
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+let s:jsx_cpo = &cpo
+set cpo&vim
+
+syntax case match
+
+if exists('b:current_syntax')
+ let s:current_syntax = b:current_syntax
+ unlet b:current_syntax
+endif
+
+if exists('s:current_syntax')
+ let b:current_syntax = s:current_syntax
+endif
+
+if hlexists("jsDebugger") || hlexists("jsNoise") " yuezk/vim-js or pangloss/vim-javascript
+ syntax cluster jsExpression add=jsxRegion
+elseif hlexists("javascriptOpSymbols") " othree/yajs.vim
+ " refine the javascript line comment
+ syntax region javascriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
+ syntax cluster javascriptValue add=jsxRegion
+ syntax cluster javascriptNoReserved add=jsxElement,jsxTag
+else " build-in javascript syntax
+ " refine the javascript line comment
+ syntax region javaScriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
+
+ " refine the template string syntax
+ syntax region javaScriptEmbed matchgroup=javaScriptEmbedBraces start=+\${+ end=+}+ contained contains=@javaScriptEmbededExpr
+
+ " add a javaScriptBlock group for build-in syntax
+ syntax region javaScriptBlock
+ \ matchgroup=javaScriptBraces
+ \ start="{"
+ \ end="}"
+ \ contained
+ \ extend
+ \ contains=javaScriptBlock,@javaScriptEmbededExpr,javaScript.*
+ \ fold
+
+ syntax cluster javaScriptEmbededExpr add=jsxRegion,javaScript.*
+endif
+
+runtime syntax/jsx_pretty.vim
+
+let b:current_syntax = 'javascript.jsx'
+
+let &cpo = s:jsx_cpo
+unlet s:jsx_cpo
+
+endif
diff --git a/after/syntax/reason/graphql.vim b/after/syntax/reason/graphql.vim
index 44a5c846..4f4ba44c 100644
--- a/after/syntax/reason/graphql.vim
+++ b/after/syntax/reason/graphql.vim
@@ -32,6 +32,6 @@ if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif
-syntax region graphqlMultilineString matchgroup=reasonMultilineString start=+graphql\_s*\zs{|+ end=+|}+ contains=@GraphQLSyntax,reasonEscape,reasonEscapeUnicode,reasonEscapeError,reasonStringContinuation keepend
+syntax region graphqlExtensionPoint matchgroup=Noise start=+\[%graphql\_s*{|+lc=10 end=+|}\_s*]+he=s+1 contains=@GraphQLSyntax keepend
endif