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

Strings with multiple whitespaces are formatted with single one #1026

Open
luca-domenichini opened this issue Sep 27, 2024 · 1 comment
Open

Comments

@luca-domenichini
Copy link

Formatting this XML:

<Tag><Inner>Test     Spaces</Inner></Tag>

leads to this:

<Tag>
    <Inner>Test Spaces</Inner>
</Tag>

I am aware of #1017, and setting "files.trimTrailingWhitespace":false does not solve the problem. All multiple whitespaces are always formatted as single whitespce:

<Tag><Inner>   Test     Spaces   </Inner></Tag>

becomes:

<Tag>
    <Inner> Test Spaces </Inner>
</Tag>
@luca-domenichini
Copy link
Author

luca-domenichini commented Sep 27, 2024

Ok, I see that there is an option where you can specify tag names for which to preserve spaces.
Adding tag <Inner> in my case, does fix the problem.
image

I think that manually adding tag names to a list is not an viable and scalable way to handle that.
Probably, it would be better to add an option checkbox that sets the default handling for multiple whitespaces: when checked, it should preveserve whitespaces for all tags. And the tagnames list, maybe, should be turned in a blacklist for tags that need whitespaces trimmed.

Also, using the legacy formatter preserves spaces as well.

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

No branches or pull requests

1 participant