Shopify / theme-tools

Everything developer experience for Shopify themes
https://shopify.dev/docs/themes
MIT License
47 stars 14 forks source link

liquid format error #189

Open RhinoLu opened 1 year ago

RhinoLu commented 1 year ago

Describe the bug The minus sign should stick with the percentage sign.

Unformatted source

{%-if customer.name==some_name-%}{%-endif-%}

Expected output

{%- if customer.name == some_name -%}{%- endif -%}

Actual output

{%- if customer.name == some_name- %}{%- endif -%}

Debugging information

Additional context

Prettier_Liquid_Plugin_-_Playground
charlespwd commented 1 year ago

Argh. That's because - is ambiguous here. It's a valid variable name character and it is a character used to close the tag.

I would have to verify if the ruby parser considers it as a variable character or as a character to close the tag for whitespace stripping.

charlespwd commented 1 year ago

Alright so ruby parser considers it as closing tag character. Indeed a bug.