Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
grndctrl opened this issue Sep 1, 2022 · 0 comments
Open

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

grndctrl opened this issue Sep 1, 2022 · 0 comments

Comments

@grndctrl
Copy link

grndctrl commented Sep 1, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant