panoply / vscode-liquid

💧Liquid language support for VS Code
https://marketplace.visualstudio.com/items?itemName=sissel.shopify-liquid
Other
171 stars 23 forks source link

whitespace control hyphen snippets missing #181

Open Arifursdev opened 7 months ago

Arifursdev commented 7 months ago

I think prev. version of the plugin had whitespace control hyphen snippets. https://shopify.github.io/liquid/basics/whitespace/

{% assign test = 'text' %}

// whitespace control:

{%- assign test = 'text' -%}
Arifursdev commented 7 months ago

182 PR fixes this.

panoply commented 7 months ago

Hey @Arifursdev,

Yeah, I dropped support for this in v4 because Æsthetic applies whitespace trims using the Liquid formatting rule delimiterTrims (see here). Extending the snippets feels a tad extraneous.

Arifursdev commented 7 months ago

Hello @panoply , I see, I don't use formatter for liquid files. and there are cases when sometimes the whitespace will not be used, eg:

<div class="classA{% if true %} ClassB{% endif %}">Test</div>
// <div class="classA ClassB">Test</div> ✅

<div class="classA{%- if true -%} ClassB{%- endif -%}">Test</div>
// <div class="classAClassB">Test</div> ❌

so I don't know if the formatter has such rules to avoid making all of them have whitespace trimmed... imo formatter is a different thing than having snippets where we can choose which one we want to use depending on situation.

I think I will just go back to prev. version for the snippets or add them locally for myself.