panoply/vscode-liquid

Unstable formatting: Long string attribute with line break

Closed this issue · 1 comments

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.

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.