Stillat / vscode-antlers-language-server

Provides rich language features for Statamic's Antlers templating language, including code completions, syntax highlighting, and more.
https://antlers.dev
MIT License
36 stars 3 forks source link

Coversion to `int_` for `unless` tag #85

Closed sjclark closed 5 months ago

sjclark commented 5 months ago

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?

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. 🙏

JohnathonKoster commented 5 months ago

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