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

Unstable formatting: Long string attribute with line break #144

Closed sentience closed 1 year ago

sentience commented 1 year ago

This:

  <body class="text-black bg-white dark:text-white dark:bg-slate-900
      accent-accent-600 p-4 md:p-12">

gets formatted to:

  <body class="text-black bg-white dark:text-white dark:bg-slate-900
            accent-accent-600 p-4 md:p-12">

which in turn gets formatted to:

  <body class="text-black bg-white dark:text-white dark:bg-slate-900
                  accent-accent-600 p-4 md:p-12">

and so on. Each time I save my template, the second line gets more whitespace added to the start of it.

panoply commented 1 year ago

Hey @sentience

This one is a known issue. When newline characters appear in value strings it will cause an applied indentation. Similar to #143 the issue is resolved in next release (#138). The way around this is to not insert newlines in values.

Sidenote

It's actually difficult to figure out a nice fluid solution to this. Considering a lot of folks choose Tailwind that result in these extraneous class expressions applied in markdown, I originally played with the idea of forcing all space separated values onto newlines, but that become a little wild. I am open to ideas on this one, meaning if you have any suggestions on how these should handled, I'd love some more insight.