dustinfarris / vim-htmlbars-inline-syntax

Highlight hbs tagged template literals
22 stars 1 forks source link

HBS Highlighting not working #2

Closed alexlafroscia closed 7 years ago

alexlafroscia commented 7 years ago

I can't seem to get this to work. Not seeing any errors in :messages, startup seems fine too. Does it I have vim-mustache-handlebars installed; does this depend on a particular JS highlighting plugin?

screen shot 2016-12-07 at 11 42 51 am
dustinfarris commented 7 years ago

Yes, I'm using pangloss/vim-javascript which the plugin relies on for the block inside a JS object.

Which plugin are you using for JS syntax? Maybe I can make it work with both.

alexlafroscia commented 7 years ago

I use the same one...

I had a JSX plugin enabled, but removed that, thinking it might be part of the issue. Apparently it's not, though.

alexlafroscia commented 7 years ago

Hmm, so if I manually run :call htmlbars_inline_syntax#highlight() in the JS file, it starts working. Must be something wrong with the autocmd

alexlafroscia commented 7 years ago

Changing the autocmd to

autocmd BufRead,BufNewFile *.js HighlightInlineHbs

Seemed to work. Maybe it's a race condition with then the command gets fired?

alexlafroscia commented 7 years ago

This looks great! Although it does remove the highlighting from the hbs and the back-ticks. Unintended side-effect?

screen shot 2016-12-07 at 12 48 36 pm
dustinfarris commented 7 years ago

Thanks for digging on this! I will update the autocmd in the README.

Yes, it seems that the tag (hbs) and the back-ticks lose their syntax group somehow. Definitely not intended.