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

multiple root elements #634

Closed
florenso opened this issue Jan 14, 2022 · 2 comments · Fixed by eclipse-lemminx/lemminx#1300
Closed

multiple root elements #634

florenso opened this issue Jan 14, 2022 · 2 comments · Fixed by eclipse-lemminx/lemminx#1300
Assignees
Labels
enhancement New feature or request formatting
Milestone

Comments

@florenso
Copy link

The formatter does not include an new line if there are multiple root elements. I think its inconsistent because it does add them for nested elements.

<parent>
    <child>
        Text
    </child>
    <child>
        Text
    </child>
</parent>
<parent>
    <child>
        Text
    </child>
</parent>

is formated as

<parent>
    <child>
        Text
    </child>
    <child>
        Text
    </child>
</parent><parent>
    <child>
        Text
    </child>
</parent>

it even becomes worse with empty root elements

<foo />
<bar />
<fizz />
<buzz />

becomes
<foo /><bar /><fizz /><buzz />

@fbricon fbricon added enhancement New feature or request formatting labels Jan 14, 2022
@angelozerr
Copy link
Contributor

I agree. Is there any chance to have some contribution?

@angelozerr
Copy link
Contributor

The https://github.com/redhat-developer/vscode-xml/blob/main/docs/Formatting.md#xmlformatexperimental should fix this issue, here the format result:

<parent>
	<child> Text </child>
	<child> Text </child>
</parent>
<parent>
	<child> Text </child>
</parent>

And for teh scond, it keep like this:

<foo />
<bar />
<fizz />
<buzz />

@JessicaJHee could you write 2 tests with those usecases please.

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants