mustache / vim-mustache-handlebars

mustache and handlebars mode for vim
mustache.github.io
455 stars 49 forks source link

Syntax highlighting for comments not working as expected #58

Closed mrzool closed 6 years ago

mrzool commented 7 years ago

Looks like the matching patterns for mustacheComment need some fixing. As it is, a contained mustache region matches the end of the comment:

screen shot 2017-04-21 at 13 15 46

There's an issue with mustacheBlockComment too. HTML tags coming after a block comment don't get highlighted properly:

screen shot 2017-04-21 at 12 49 29

The same doesn't happen with a normal comment:

screen shot 2017-04-21 at 13 13 03

Here are the lines in syntax/mustache.vim that need fixing (tried myself without success):

syntax region mustacheComment      start=/{{!/rs=s+2   skip=/{{.\{-}}}/ end=/}}/re=e-2   contains=Todo contained containedin=mustacheInside,@htmlMustacheContainer
syntax region mustacheBlockComment start=/{{!--/rs=s+2 skip=/{{.\{-}}}/ end=/--}}/re=e-2 contains=Todo contained extend containedin=mustacheInside,@htmlMustacheContainer

Any help with this would be greatly appreciated. Pinging @juvenn since he's the original author.

mrzool commented 7 years ago

Should someone run into the same issue or one of the maintainers want to look into this, I managed to get this working by tweaking @juvenn's older, simpler and now deprecated syntax file.