Skip to content

Allow formatter to keep blank lines #110

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

Closed
toellrich opened this issue Mar 17, 2022 · 4 comments
Closed

Allow formatter to keep blank lines #110

toellrich opened this issue Mar 17, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request formatter
Milestone

Comments

@toellrich
Copy link

toellrich commented Mar 17, 2022

The formatter currently always removes blank lines. It would be great if, just like with the XML editor (see attached screenshot), it would be configurable to keep blank lines.

Preferences_2022_03_17_10_25_17
.

@de-jcup
Copy link
Owner

de-jcup commented Mar 18, 2022

The formatting/pretty printing is done by snake yaml parser.

AFAIKS when looking at
https://bitbucket.org/snakeyaml/snakeyaml/wiki/Documentation snake does not provide an option to keep blank lines.

So it would be necessary to create a workaround here - like done for comments (which are always dropped by snake).

@toellrich
Copy link
Author

If it's too much of a hassle, don't worry about it. It's not a big deal. I just think that the blank lines improve readability and IntelliJ keeps them which would mean that team members who use different IDEs would produce differently formatted YAML files.

@de-jcup de-jcup added this to the 1.9.0 milestone Apr 7, 2022
@de-jcup de-jcup self-assigned this Apr 7, 2022
@de-jcup de-jcup added enhancement New feature or request formatter labels Apr 7, 2022
@de-jcup de-jcup closed this as completed in 69d4393 Apr 7, 2022
@de-jcup
Copy link
Owner

de-jcup commented Apr 7, 2022

New preference entry

With last commit you have a new preference entry (per default the "Clear all blank lines" is disabled like in IntelliJ)
image

An example

Origin

image

Formatted with "Clear blank lines" disabled

image

Formatted with "Clear blank lines" enabled (old behaviour)

image

@de-jcup
Copy link
Owner

de-jcup commented Apr 7, 2022

@toellrich : Just release 1.9.0 on eclipse marketplace - so feature is available now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request formatter
Projects
None yet
Development

No branches or pull requests

2 participants