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

Consider removing xml.format.preserveEmptyContent for experimental formatter #1346

Closed
JessicaJHee opened this issue Oct 26, 2022 · 1 comment · Fixed by #1376
Closed

Consider removing xml.format.preserveEmptyContent for experimental formatter #1346

JessicaJHee opened this issue Oct 26, 2022 · 1 comment · Fixed by #1376
Labels
enhancement New feature or request formatting This issue or enhancement is related to formatting support
Milestone

Comments

@JessicaJHee
Copy link
Contributor

The experimental formatter introduces a new element category called preserve space, which preserves all white spaces within the specified element tag. Currently, when preserveEmptyContent = true, it has the same behavior as preserve space, making this setting redundant.

Note: consider its behavior when used alongside with other settings:

https://github.com/redhat-developer/vscode-xml/blob/main/docs/Formatting.md#xmlformatpreservednewlines

  • preservedNewLines: this setting is already prioritized over preserveEmptyContent, it's behavior would be unaffected with the removal of preserveEmptyContent. It formats the xml nicely while allowing the user to set a specified number of new lines they would like to keep.

Example:
Before with preservedNewLines = 2:

<foo>

test1           test2


    test3
</foo>

After:

<foo>

    test1 test2


    test3
</foo>

https://github.com/redhat-developer/vscode-xml/blob/main/docs/Formatting.md#xmlformatjoincontentlines

  • joinContentLines If an user wants to normalize the white spaces with in an empty tag, they can use xml.format.joinContentLines instead, which currently has lower priority compared to preserveEmptyContent and the preserve space category.

Example:
Before with joinContentLines = true and preserveEmptyContent = false:

<a>

</a>

After:

<a> </a>
@enxio
Copy link

enxio commented Nov 11, 2022

@JessicaJHee, FWIW, I'd be in favor of removing it from the experimental formatter. See #1366.

@angelozerr angelozerr added this to the 0.23.0 milestone Nov 23, 2022
@datho7561 datho7561 added enhancement New feature or request formatting This issue or enhancement is related to formatting support labels Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request formatting This issue or enhancement is related to formatting support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants