g-plane / markup_fmt

Configurable HTML, Vue, Svelte, Astro, Angular, Jinja, Twig, Nunjucks and Vento formatter with dprint integration.
https://dprint.dev/plugins/markup_fmt/
MIT License
100 stars 9 forks source link

[Astro] Multiline method chains in expressions are not indented properly #54

Closed michaelhthomas closed 1 month ago

michaelhthomas commented 1 month ago

In an Astro template, an expression of the form

{
  variable
    .map(x => x * 2)
    .filter(x => x != 0)
}

is incorrectly formatted as

{
  variable
-   .map(x => x * 2)
-   .filter(x => x != 0)
+ .map(x => x * 2)
+ .filter(x => x != 0)
}

so the method chains are indented at the same level as the variable they act on, instead of having a hanging indent.

Whereas using just the typescript plugin,

variable
.map(x => x * 2)
.filter(x => x != 0)

is correctly formatted as

 variable
-.map(x => x * 2)
-.filter(x => x != 0)
+  .map(x => x * 2)
+  .filter(x => x != 0)