alohaas / language-nunjucks

Syntax highlighting for nunjucks templates in atom.
MIT License
42 stars 13 forks source link

Add Set snippet #3

Closed silvenon closed 9 years ago

silvenon commented 9 years ago

Not sure if the value should be quoted or not.

silvenon commented 9 years ago

Updated.

alohaas commented 9 years ago

Thanks for the pull request! Looks like it all checks out :)

The $0 is a regular expression that means 'the entire matched string'. My thinking was that you could set a variable to a string, a function, an array, an object or a value so we would want to leave in any formatting that already existed for that syntax. It builds in flexibility and allows for whatever other highlighting is going on to persist.

silvenon commented 9 years ago

I'm still not exactly sure what it does, but I do know it's a bit annoying if I split the value across multiple lines and try to indent.

set<tab>
{% set var = value %}<tab>
{% set page = value %}<tab>
{% set page = {} %}<enter><enter><up arrow>
{% set page = {

} %}<tab>

After the last tab it goes to the end of the line (where $0 is) instead of indenting, so I have to go back.