summaryrefslogtreecommitdiffstats
path: root/after
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-12-31 14:05:09 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2019-12-31 14:05:09 +0100
commitb8a5504021e0d21310bc603855ac8107828b5759 (patch)
tree2f2bf182b686597e7cc4c4f1b7d35881f9993f55 /after
parentcea0d08a062478503814e51aa21c6486a0dd1b21 (diff)
downloadvim-polyglot-b8a5504021e0d21310bc603855ac8107828b5759.tar.gz
vim-polyglot-b8a5504021e0d21310bc603855ac8107828b5759.zip
Update
Diffstat (limited to 'after')
-rw-r--r--after/ftplugin/tsx.vim (renamed from after/ftplugin/typescript.vim)0
-rw-r--r--after/ftplugin/typescriptreact.vim2
-rw-r--r--after/indent/tsx.vim (renamed from after/indent/typescript.vim)0
-rw-r--r--after/indent/typescriptreact.vim2
-rw-r--r--after/syntax/javascript/graphql.vim55
-rw-r--r--after/syntax/javascriptreact/graphql.vim5
-rw-r--r--after/syntax/jsx_pretty.vim2
-rw-r--r--after/syntax/tsx.vim63
-rw-r--r--after/syntax/typescript.vim60
-rw-r--r--after/syntax/typescript/graphql.vim23
-rw-r--r--after/syntax/typescriptreact.vim2
-rw-r--r--after/syntax/typescriptreact/graphql.vim5
-rw-r--r--after/syntax/vue/graphql.vim5
13 files changed, 137 insertions, 87 deletions
diff --git a/after/ftplugin/typescript.vim b/after/ftplugin/tsx.vim
index e29d1e41..e29d1e41 100644
--- a/after/ftplugin/typescript.vim
+++ b/after/ftplugin/tsx.vim
diff --git a/after/ftplugin/typescriptreact.vim b/after/ftplugin/typescriptreact.vim
index 931839b1..223f77c5 100644
--- a/after/ftplugin/typescriptreact.vim
+++ b/after/ftplugin/typescriptreact.vim
@@ -1,5 +1,5 @@
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
-source <sfile>:h/typescript.vim
+source <sfile>:h/tsx.vim
endif
diff --git a/after/indent/typescript.vim b/after/indent/tsx.vim
index dd8ee271..dd8ee271 100644
--- a/after/indent/typescript.vim
+++ b/after/indent/tsx.vim
diff --git a/after/indent/typescriptreact.vim b/after/indent/typescriptreact.vim
index 931839b1..223f77c5 100644
--- a/after/indent/typescriptreact.vim
+++ b/after/indent/typescriptreact.vim
@@ -1,5 +1,5 @@
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
-source <sfile>:h/typescript.vim
+source <sfile>:h/tsx.vim
endif
diff --git a/after/syntax/javascript/graphql.vim b/after/syntax/javascript/graphql.vim
index bf3ee41d..1c5732ca 100644
--- a/after/syntax/javascript/graphql.vim
+++ b/after/syntax/javascript/graphql.vim
@@ -1,5 +1,28 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org>
+"
+" Permission is hereby granted, free of charge, to any person obtaining a copy
+" of this software and associated documentation files (the "Software"), to
+" deal in the Software without restriction, including without limitation the
+" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+" sell copies of the Software, and to permit persons to whom the Software is
+" furnished to do so, subject to the following conditions:
+"
+" The above copyright notice and this permission notice shall be included in
+" all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+" IN THE SOFTWARE.
+"
+" Language: GraphQL
+" Maintainer: Jon Parise <jon@indelible.org>
+
if exists('b:current_syntax')
let s:current_syntax = b:current_syntax
unlet b:current_syntax
@@ -11,17 +34,31 @@ endif
let s:tags = '\%(' . join(graphql#javascript_tags(), '\|') . '\)'
-exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\`+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend'
-exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
+if graphql#has_syntax_group('jsTemplateExpression')
+ " pangloss/vim-javascript
+ exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend'
+ exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
+ syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=jsTemplateExpression containedin=graphqlFold keepend
+
+ hi def link graphqlTemplateString jsTemplateString
+ hi def link graphqlTaggedTemplate jsTaggedTemplate
+ hi def link graphqlTemplateExpression jsTemplateExpression
-" Support expression interpolation ((${...})) inside template strings.
-syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=jsTemplateExpression containedin=graphqlFold keepend
+ syn cluster jsExpression add=graphqlTaggedTemplate
+ syn cluster graphqlTaggedTemplate add=graphqlTemplateString
+elseif graphql#has_syntax_group('javaScriptStringT')
+ " runtime/syntax/javascript.vim
+ exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,javaScriptSpecial,javaScriptEmbed,@htmlPreproc extend'
+ exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
+ syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=@javaScriptEmbededExpr containedin=graphqlFold keepend
-hi def link graphqlTemplateString jsTemplateString
-hi def link graphqlTaggedTemplate jsTaggedTemplate
-hi def link graphqlTemplateExpression jsTemplateExpression
+ hi def link graphqlTemplateString javaScriptStringT
+ hi def link graphqlTaggedTemplate javaScriptEmbed
+ hi def link graphqlTemplateExpression javaScriptEmbed
-syn cluster jsExpression add=graphqlTaggedTemplate
-syn cluster graphqlTaggedTemplate add=graphqlTemplateString
+ syn cluster htmlJavaScript add=graphqlTaggedTemplate
+ syn cluster javaScriptEmbededExpr add=graphqlTaggedTemplate
+ syn cluster graphqlTaggedTemplate add=graphqlTemplateString
+endif
endif
diff --git a/after/syntax/javascriptreact/graphql.vim b/after/syntax/javascriptreact/graphql.vim
new file mode 100644
index 00000000..c86f9d23
--- /dev/null
+++ b/after/syntax/javascriptreact/graphql.vim
@@ -0,0 +1,5 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+
+runtime! after/syntax/javascript/graphql.vim
+
+endif
diff --git a/after/syntax/jsx_pretty.vim b/after/syntax/jsx_pretty.vim
index 546e9d48..b2cf858a 100644
--- a/after/syntax/jsx_pretty.vim
+++ b/after/syntax/jsx_pretty.vim
@@ -72,7 +72,7 @@ syntax region jsxExpressionBlock
\ end=+}+
\ contained
\ extend
- \ contains=@jsExpression,jsSpreadExpression,@javascriptExpression,javascriptSpreadOp,@javaScriptEmbededExpr,@typescriptExpression,typescriptObjectSpread
+ \ contains=@jsExpression,jsSpreadExpression,@javascriptExpression,javascriptSpreadOp,@javaScriptEmbededExpr,@typescriptExpression,typescriptObjectSpread,jsComment,@javascriptComments,javaScriptLineComment,javaScriptComment,typescriptLineComment,typescriptComment
" <foo.bar>
" ~
diff --git a/after/syntax/tsx.vim b/after/syntax/tsx.vim
index 863da121..36854168 100644
--- a/after/syntax/tsx.vim
+++ b/after/syntax/tsx.vim
@@ -1,28 +1,63 @@
-if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Vim syntax file
+"
+" Language: javascript.jsx
+" Maintainer: MaxMellon <maxmellon1994@gmail.com>
+" Depends: leafgarland/typescript-vim
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+if get(g:, 'vim_jsx_pretty_disable_tsx', 0)
+ finish
+endif
+
+let s:jsx_cpo = &cpo
+set cpo&vim
+
+syntax case match
-" 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
+" refine the typescript line comment
+syntax region typescriptLineComment start=+//+ end=/$/ contains=@Spell,typescriptCommentTodo,typescriptRef extend keepend
+
+for syntax_name in ['tsxRegion', 'tsxFragment']
+ if hlexists(syntax_name)
+ exe 'syntax clear ' . syntax_name
+ endif
+endfor
+
+if !hlexists('typescriptTypeCast')
+ " add a typescriptBlock group for typescript
+ syntax region typescriptBlock
+ \ matchgroup=typescriptBraces
+ \ start="{"
+ \ end="}"
+ \ contained
+ \ extend
+ \ contains=@typescriptExpression,typescriptBlock
+ \ fold
+ hi def link typescriptTypeBrackets typescriptOpSymbols
+endif
-hi def link graphqlTemplateString typescriptTemplate
-hi def link graphqlTemplateExpression typescriptTemplateSubstitution
+runtime syntax/jsx_pretty.vim
+syntax cluster typescriptExpression add=jsxRegion,typescriptParens
+" Fix type casting ambiguity with JSX syntax
+syntax match typescriptTypeBrackets +[<>]+ contained
+syntax match typescriptTypeCast +<\([_$A-Za-z0-9]\+\)>\%(\s*\%([_$A-Za-z0-9]\+\s*;\?\|(\)\%(\_[^<]*</\1>\)\@!\)\@=+ contains=typescriptTypeBrackets,@typescriptType,typescriptType nextgroup=@typescriptExpression
-syn cluster typescriptExpression add=graphqlTaggedTemplate
-syn cluster graphqlTaggedTemplate add=graphqlTemplateString
+let b:current_syntax = 'typescript.tsx'
+let &cpo = s:jsx_cpo
+unlet s:jsx_cpo
endif
diff --git a/after/syntax/typescript.vim b/after/syntax/typescript.vim
deleted file mode 100644
index 8b00fb45..00000000
--- a/after/syntax/typescript.vim
+++ /dev/null
@@ -1,60 +0,0 @@
-if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Vim syntax file
-"
-" Language: javascript.jsx
-" Maintainer: MaxMellon <maxmellon1994@gmail.com>
-" Depends: leafgarland/typescript-vim
-"
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-if get(g:, 'vim_jsx_pretty_disable_tsx', 0)
- finish
-endif
-
-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
-
-" refine the typescript line comment
-syntax region typescriptLineComment start=+//+ end=/$/ contains=@Spell,typescriptCommentTodo,typescriptRef extend keepend
-
-for syntax_name in ['tsxRegion', 'tsxFragment']
- if hlexists(syntax_name)
- exe 'syntax clear ' . syntax_name
- endif
-endfor
-
-if !hlexists('typescriptTypeCast')
- " add a typescriptBlock group for typescript
- syntax region typescriptBlock
- \ matchgroup=typescriptBraces
- \ start="{"
- \ end="}"
- \ contained
- \ extend
- \ contains=@typescriptExpression,typescriptBlock
- \ fold
-endif
-
-syntax cluster typescriptExpression add=jsxRegion,typescriptParens
-
-runtime syntax/jsx_pretty.vim
-
-let b:current_syntax = 'typescript.tsx'
-
-let &cpo = s:jsx_cpo
-unlet s:jsx_cpo
-
-endif
diff --git a/after/syntax/typescript/graphql.vim b/after/syntax/typescript/graphql.vim
index a5d6a9ce..f30c4efd 100644
--- a/after/syntax/typescript/graphql.vim
+++ b/after/syntax/typescript/graphql.vim
@@ -1,5 +1,28 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org>
+"
+" Permission is hereby granted, free of charge, to any person obtaining a copy
+" of this software and associated documentation files (the "Software"), to
+" deal in the Software without restriction, including without limitation the
+" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+" sell copies of the Software, and to permit persons to whom the Software is
+" furnished to do so, subject to the following conditions:
+"
+" The above copyright notice and this permission notice shall be included in
+" all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+" IN THE SOFTWARE.
+"
+" Language: GraphQL
+" Maintainer: Jon Parise <jon@indelible.org>
+
if exists('b:current_syntax')
let s:current_syntax = b:current_syntax
unlet b:current_syntax
diff --git a/after/syntax/typescriptreact.vim b/after/syntax/typescriptreact.vim
index 931839b1..223f77c5 100644
--- a/after/syntax/typescriptreact.vim
+++ b/after/syntax/typescriptreact.vim
@@ -1,5 +1,5 @@
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
-source <sfile>:h/typescript.vim
+source <sfile>:h/tsx.vim
endif
diff --git a/after/syntax/typescriptreact/graphql.vim b/after/syntax/typescriptreact/graphql.vim
new file mode 100644
index 00000000..62604d20
--- /dev/null
+++ b/after/syntax/typescriptreact/graphql.vim
@@ -0,0 +1,5 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+
+runtime! after/syntax/typescript/graphql.vim
+
+endif
diff --git a/after/syntax/vue/graphql.vim b/after/syntax/vue/graphql.vim
new file mode 100644
index 00000000..c86f9d23
--- /dev/null
+++ b/after/syntax/vue/graphql.vim
@@ -0,0 +1,5 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+
+runtime! after/syntax/javascript/graphql.vim
+
+endif