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

Preserve one line #675

Closed
ebiscaia opened this issue May 29, 2023 · 7 comments
Closed

Preserve one line #675

ebiscaia opened this issue May 29, 2023 · 7 comments
Labels

Comments

@ebiscaia
Copy link

Hi guys,

I think this option makes more sense than a simple preserve-lines because sometimes you would like a gap to make the code more readable, but not having it as disjoined parts.

Best regards,

Eduardo

@welcome
Copy link

welcome bot commented May 29, 2023

Thanks for opening your first issue here!

@christopherpickering
Copy link
Contributor

Hey thanks. Can you give an example of how it would be used? I'm not following you completely.

@ebiscaia
Copy link
Author

ebiscaia commented May 30, 2023

Sorry, what I mean is to remove all the blank lines but one when there are two or more consecutive blank lines. Today the formatter either removes all the lines (no option provided) or keep them all (--preserve-blank-lines). I have the following snippet:

<button class="navbar-toggler"                                                                                                                                                                                        
   Code here                                                                                                                                                                          
</button>


                                                                                                                                                                                                            
<div class="collapse navbar-collapse" id="navbarToggle">
    Code here                                                                                                                                                           
</div>

I would like after formatting is:

<button class="navbar-toggler"                                                                                                                                                                                        
   Code here                                                                                                                                                                          
</button>
                                                                                                                                                                                                       
<div class="collapse navbar-collapse" id="navbarToggle">
    Code here                                                                                                                                                           
</div>

Thanks again

@christopherpickering
Copy link
Contributor

Ok cool, so basically we would consolidate blank lines into a max #?
Add a --max-blank-lines=# arg or something along these lines?

@ebiscaia
Copy link
Author

Yep, that is what I was thinking.

@christopherpickering
Copy link
Contributor

hey @ebiscaia, thanks! The next release will include a --max-blank-lines <integer> flag that will let you consolidate blank lines down to a fixed number. You can also set it through the json or toml files.

christopherpickering pushed a commit that referenced this issue Jun 12, 2023
# [1.31.0](v1.30.2...v1.31.0) (2023-06-12)

### Bug Fixes

* **formatter:** fixed `line_break_after_multiline_tag` to force break in all cases ([3b37ec8](3b37ec8)), closes [#680](#680)
* **formatter:** fixed isolated quotes being deleted from attributes ([19425f9](19425f9)), closes [#652](#652)
* **formatter:** fixed wild match on template tags ([d288b78](d288b78)), closes [#686](#686)
* **linter:** fixed false positive on t001 ([1caf4c4](1caf4c4)), closes [#606](#606)

### Features

* **formatter:** added `max-blank-lines` flag to consolidate blank lines ([4a7897f](4a7897f)), closes [#675](#675)
* **formatter:** added support for symphony forms ([e716ddc](e716ddc)), closes [#476](#476)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.31.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

2 participants