Open aeschli opened 6 years ago
The problem is that the handlebar grammar uses the 'source.js' grammar for embedded code. That's not really correct due to the templates. The grammar that we use in VSCode doesn't handle the {{{ helper 'param'}}} and gets stuck in a rule (FYI @sheetalkamat) . It's a weakness of TextMate that it doesn't have a proper embedding story and a problem in the embedded code can ruin the colouring of the rest of the file IMO the right approach is for the handlebars grammar to not include source.js, but have included simple highlighting rules for embedded code, e.g. do keyword, comment and strings highlighting.
Hey @aeschli,
Really sorry for taking this long to get back to you!
I'm not really sure what's going on here, this problem doesn't seem to manifest in Sublime Text:
I'm very apprehensive about including other syntaxes as that would mean I need to maintain not only Handlebars, but potentially several others. With this particular usage (as in injecting a value into a script, not just as an HTML template), you could be using Handlebars in any other language – not just JS –, so I would need to potentially include anything from PHP or ASP, etc.
I might be totally misunderstanding what this is about though, so in that case please explain! 😺
Hi @daaain, the difference to Sublime is that Sublime uses a different JavaScript grammar than us.
That grammar doesn't seem to bother about the {{{
syntax, but, if you ask me, that's just luck and not something you can expect from every embedded grammar.
I understand that you'd prefer to keep the grammar minimal and reuse grammars from other languages, but given that handlebar templates can be everywhere, you still might want to look into doing the colouring of embedded code yourself. That could be very minimal with highlighting of keywords, comments and strings.
Actually in my Sublime Text (v3.3.1, Build 3176) the problem does exist:
From @Jusys on October 9, 2017 21:38
Steps to Reproduce:
If call to helper is without string parameter, everything is ok:
Reproduces without extensions: I have no extensions installed
Copied from original issue: Microsoft/vscode#35934