daaain / Handlebars

Fullest Handlebars.js templating support for Sublime Text 2 / 3. Also drives syntax colouring on Github and in Visual Studio Code. Install from: https://packagecontrol.io/packages/Handlebars.
MIT License
301 stars 48 forks source link

Improve coloring of block expressions #94

Closed aeschli closed 7 years ago

aeschli commented 7 years ago
{{#list people}}{{firstName}} {{lastName}}{{/list}}

{{ and #list get scope support.constant.handlebars. It would be nice if if the block expressions gets a scope like: 'keyword.control'. That's matching what JavaScript gives to keywords like 'if', 'while'

firstName gets variable.parameter.handlebars

daaain commented 7 years ago

Hey @aeschli, I finally got around to have a look at this and created a Pull request: #95.

It seems to be working, but I'm not sure if it's quite right yet. The colours with Sublime Text's default theme seem a bit off, so I'm thinking this would make sense if the closing tags (eg /list), inline keywords (eg else) and maybe even inline helpers (eg customHelper in {{customHelper "test1" 'test2' 32 true object.value}}) were the same?

image

aeschli commented 7 years ago

Cool. Yes, coloring the closing tag like the block expression sounds like the right thing to me, and also the other suggestions make sense. That said, I'm not a too deep into handlebars, I created the issue on behalf of @t-sauer. Thomas, thoughts?

t-sauer commented 7 years ago

I think having the same colors for inline and block expressions is totally fine (at least for me).

daaain commented 7 years ago

OK, I just pushed a new version, in the end I decided not to apply the same scope on inline expressions as that's shared with variables and it was just too much.

But all block expression opening and closing tags, and else should have the new colour now.

Let me know if it works well for you!