Skip to content

Commit 3b370b6

Browse files
committed
Avoid re-sourcing syntax/javascript.vim
I had assumed this was harmless, but apparently it does actually cause some issues (like #17).
1 parent 65beca9 commit 3b370b6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

autoload/htl_syntax.vim

+4-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ function! htl_syntax#amend(options)
77
let s:current_syntax=b:current_syntax
88
unlet b:current_syntax
99
endif
10+
let g:main_syntax = 'java'
1011
syn include @HTMLSyntax syntax/html.vim
12+
unlet g:main_syntax
13+
" we let/unlet g:main_syntax as a hack to prevent syntax/html.vim from
14+
" re-sourcing syntax/javascript.vim
1115
if exists('s:current_syntax')
1216
let b:current_syntax=s:current_syntax
1317
endif
@@ -23,13 +27,6 @@ function! htl_syntax#amend(options)
2327
endif
2428
endif
2529

26-
if (&filetype ==# 'javascript.jsx')
27-
" sourcing html syntax will re-source javascript syntax because html has
28-
" <script> tags. However, re-sourcing javascript will erase jsx
29-
" modifications, so we need to additionally re-source jsx syntax.
30-
runtime syntax/jsx.vim
31-
endif
32-
3330
exec 'syntax region litHtmlRegion
3431
\ contains=@HTMLSyntax,' . (a:options.typescript ? 'typescriptInterpolation,typescriptTemplateSubstitution' : 'jsTemplateExpression') . '
3532
\ containedin=typescriptBlock

0 commit comments

Comments
 (0)