vim-js-pretty-template
vim-js-pretty-template copied to clipboard
Does not work with yajs.vim and vim-jsx
First of all, thanks for creating this plugin. This is definitely a feature we need in vim!
Sadly this plugin doesn't seem to work when used together with yajs.vim and vim-jsx. As soon as the filetype is changed to javascript.jsx, JsPreTmpl will be unable to change the syntax highlighting of the template strings. The syntax for template strings will be left at the yajs.vim default of javascriptTemplate.
However, if you set autocmd FileType javascript.jsx syn clear javascriptTemplate
JsPreTmpl will work, although you will lose the ability to highlight the template strings properly. (I am also unable to get call jspretmpl#register_tag('styled', 'scss')
to work with this)
Any ideas how this can be resolved?
They seem to work when they aren't assigned to a variable.
// This works
sql`select * from users;`
// This doesn't
const str = sql`select * from users;`
I wonder if we're both seeing the same root problem. I'm seeing this with Pangloss's JavaScript syntax too — https://github.com/Quramy/vim-js-pretty-template/issues/19.
Same issue with https://github.com/HerringtonDarkholme/yats.vim bundled by https://github.com/sheerun/vim-polyglot.
I tried adding SQL tagged template highlighting with:
call jspretmpl#register_tag('sql', 'sql')
autocmd FileType javascript JsPreTmpl
autocmd FileType javascript.jsx JsPreTmpl
autocmd FileType typescript JsPreTmpl
autocmd FileType typescript syn clear foldBraces
It works for JavaScript, but not for TypeScript. It works for TypeScript if I use https://github.com/leafgarland/typescript-vim though. I tried removing autocmd FileType typescript syn clear foldBraces
and adding autocmd FileType typescriptreact JsPreTmpl
to no avail.
As pointed out by @sheldonkwok it does work when it's not assigned to a variable.