Stillat/vscode-antlers-language-server

Coversion to `int_` for `unless` tag

sjclark opened this issue · 1 comments

Describe the bug
The code following results in a reference being replaced with an int_ reference

{{ unless ({cookie:visited}) | contains(url) }}
  {{ new_cookie = (({cookie:visited}) + ',' + ({url})) }}
  {{ cookie:set :visited="new_cookie" }}
{{ /unless }}

results in the first line being changed to {{ unless (int_4d5317e034b8) | contains(url) }}
Interestingly it seems to work fine if logic is changed to:

{{ if ({cookie:visited}) | contains(url) }}
{{ else }}
  {{ new_cookie = (({cookie:visited}) + ',' + ({url})) }}
  {{ cookie:set :visited="new_cookie" }}
{{ /if }}

Still occurs if {cookie:visited} (instead of surrounded by brackets) is used.

Deleting the rest of the template does nothing - ie. the code above in isolation is enough to trigger this.

Impacted Products
Which Antlers Toolbox products does this bug apply to?

  • [- ] Antlers Toolbox for VS Code (v2.6.14)

Please let me know if I can provide more info? Totally possible my syntax is off - haven't played with the cookie function before today. 🙏

Thanks for the report! I've released a patch to correct this in the following versions:

  • Antlers Toolbox for VS Code 2.6.15
  • prettier-plugin-antlers (npm) 2.0.2
  • antlers-formatter (npm) 1.2.11