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

Ignore block comments behaves strangely #159

Closed entozoon closed 9 months ago

entozoon commented 1 year ago

Whenever I format a .liquid document with contents such as:

<html>
  {% comment %} @prettify-ignore-start {% endcomment %}
    foo
  {% comment %} @prettify-ignore-end {% endcomment %}
</html>

It duplicates the ignored contents, outputting:

<html>
  {% comment %} @prettify-ignore-start {% endcomment %}
    foo
  {% comment %} @prettify-ignore-end {% endcomment %}
  {% comment %} @prettify-ignore-start {% endcomment %}
    foo
  {% comment %} @prettify-ignore-end {% endcomment %}
</html>

And so on and so forth. Bizarre!

Same behaviour is witnessed with with <!-- @prettify-ignore-start --> (but not {% # @prettify-ignore-start %} - which doesn't work at all)

panoply commented 1 year ago

Hey @entozoon

This is known issue. You can update to v4.0.0 by downloading the VSIX and installing it manually which irons out that logic by the difference is that it is no longer using Prettify but instead Æsthetic has superseded the project. In Æsthetic you can use the following ignores:

<html>
  {% comment %} esthetic-ignore-start {% endcomment %}
    foo
  {% comment %} esthetic-ignore-end {% endcomment %}
</html>

I've tested this and things work as intended. If you need help upgrading manually, let me know. I plan to ship 4.0.0 very soon but there are a ton of breaking changes and updates, most of which pertain to Formatting and Completions etc.

entozoon commented 1 year ago

@panoply That's great to hear, I'm very happy to wait for v4.0.0. I heard about Æsthetic but didn't know it was rolling into this plugin eventually so that's great.

panoply commented 9 months ago

v4.0 uses Æsthetic as per above comment! Hope it helps.

🚢