Skip to content

The plugin removes all blank lines, which I think it shouldn't. #103

@grndctrl

Description

@grndctrl

I like to keep my html-code separated from twig-code with blank lines.

<section>

  {% if condition %}
    {% set var = value %}
  {% endif %}

  <div class="container">
    {{ var }}
  </div>
  
</section>

However the plugin ignores my single blank line formatting and removes some of them. And although it's compact, it's not "pretty". I don't see why there the blank after the if statement is kept while others are removed.

<section>
  {% if condition %}
    {% set var = value %}
  {% endif %}

  <div class="container">
    {{ var }}
  </div>
</section>

I think this is wrong, as the official prettier docs state that prettier collapses multiple blank lines into one, but single empty lines are allowed.

Now I understand changing this might impact other codebases heavily, so I'd like to see a twigAllowSingleEmptyLines option or something like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions