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

Experimental formatter ignores xml.format.preservedNewlines #797

Closed
kapexx opened this issue Oct 21, 2022 · 1 comment · Fixed by eclipse/lemminx#1341
Closed

Experimental formatter ignores xml.format.preservedNewlines #797

kapexx opened this issue Oct 21, 2022 · 1 comment · Fixed by eclipse/lemminx#1341
Milestone

Comments

@kapexx
Copy link

kapexx commented Oct 21, 2022

Thanks for working on the new experimental formatter. I've just tried it on a few documents and compared them to the old formatting. I see a lot differences because the setting xml.format.preservedNewlines seems to be ignored in some cases.

With the setting "xml.format.preservedNewlines": 2 when formatting following document

<foo>

    <bar>1</bar>

    <bar>2</bar>


    <bar>3</bar>



    <bar>4</bar>

</foo>

I would expected this result:

<foo>

    <bar>1</bar>

    <bar>2</bar>


    <bar>3</bar>


    <bar>4</bar>

</foo>

The actual result is:

<foo>
    <bar>1</bar>
    <bar>2</bar>


    <bar>3</bar>


    <bar>4</bar>
</foo>

The three empty lines after <bar>3</bar> collapse into two empty lines as expected. But it looks like all single empty line are removed.

@angelozerr
Copy link
Contributor

Thanks so much @kapexx for having reported this issue. It should be fixed now. Don't hesitate to report other issues with experimental formatter. Our goal is to swith the old formatter with the experimental once we will be cover all usecases that old formatter is supporting.

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