diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2019-06-08 13:25:41 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-06-08 13:25:41 +0200 |
commit | 26c678b08d88b658ec6069eb2ada2b2ba21c5d39 (patch) | |
tree | ebf7500bafee56b195bf52ced286fe29e5b3f485 /ftdetect | |
parent | 17ecfbdabcfdf294dae27c506fb68b58175199b5 (diff) | |
download | vim-polyglot-26c678b08d88b658ec6069eb2ada2b2ba21c5d39.tar.gz vim-polyglot-26c678b08d88b658ec6069eb2ada2b2ba21c5d39.zip |
Change jsx/tsx provider, closes #400
Diffstat (limited to 'ftdetect')
-rw-r--r-- | ftdetect/polyglot.vim | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 830b1fb7..15eea891 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -606,59 +606,6 @@ au BufNewFile,BufRead *.ect set filetype=jst augroup end endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1 - augroup filetypedetect - " jsx, from javascript.vim in amadeus/vim-jsx -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Vim ftdetect file -" -" Language: JSX (JavaScript) -" Maintainer: Max Wang <mxawng@gmail.com> -" -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/' - -" if g:jsx_check_react_import == 1 -" parse the first line of js file (skipping comments). When it has a 'react' -" importation, we guess the user writes jsx -" endif -let s:jsx_prevalent_pattern = - \ '\v\C%^\_s*%(%(//.*\_$|/\*\_.{-}\*/)@>\_s*)*%(import\s+\k+\s+from\s+|%(\l+\s+)=\k+\s*\=\s*require\s*\(\s*)[`"'']react>' - -" Whether to set the JSX filetype on *.js files. -fu! <SID>EnableJSX() - " Whether the .jsx extension is required. - if !exists('g:jsx_ext_required') - let g:jsx_ext_required = 0 - endif - - " Whether the @jsx pragma is required. - if !exists('g:jsx_pragma_required') - let g:jsx_pragma_required = 0 - endif - - if g:jsx_pragma_required && !exists('b:jsx_ext_found') - " Look for the @jsx pragma. It must be included in a docblock comment - " before anything else in the file (except whitespace). - let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw') - endif - - if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif - if g:jsx_ext_required && !exists('b:jsx_ext_found') && - \ !(get(g:,'jsx_check_react_import') && search(s:jsx_prevalent_pattern, 'nw')) - return 0 - endif - return 1 -endfu - -autocmd BufNewFile,BufRead *.jsx let b:jsx_ext_found = 1 -autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx -autocmd BufNewFile,BufRead *.js - \ if <SID>EnableJSX() | set filetype=javascript.jsx | endif - augroup end -endif - if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1 augroup filetypedetect " kotlin, from kotlin.vim in udalov/kotlin-vim @@ -1377,22 +1324,6 @@ au BufRead,BufNewFile *.ax set syntax=tptp augroup end endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tsx') == -1 - augroup filetypedetect - " tsx, from typescript.vim in ianks/vim-tsx -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Vim ftdetect file -" -" Language: TSX (JavaScript) -" Maintainer: Ian Ker-Seymer <i.kerseymer@gmail.com> -" -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -autocmd BufNewFile,BufRead *.tsx let b:tsx_ext_found = 1 -autocmd BufNewFile,BufRead *.tsx set filetype=typescript.tsx - augroup end -endif - if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1 augroup filetypedetect " twig, from twig.vim in lumiliet/vim-twig |