-
Notifications
You must be signed in to change notification settings - Fork 82
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
Preserve line breaks when formatting #247
Comments
@pc-robelbois could you attach a simple XML file which causes your problem please. |
@angelozerr Here is a minimal sample. Before
After formatting
|
@pc-robelbois what editor/IDE do you usually use to format your XML documents while preserving line breaks between attributes? |
Previously, theses files were edited as raw text files (not formatter). |
@angelozerr FYI, here are the Intellij IDEA settings related to word wrapping in XML docs: |
@angelozerr I do identify two different features.
While both are imo required, my request is about the first one. Your proposal is about the second one. |
indeed, that why I said it might also help. |
Let's add "xml.format.preserveLineBreaks":true, that would apply for non empty lines. |
Hi @pc-robelbois, I made a PR for this issue: eclipse-lemminx/lemminx#772 that preserves the line breaks that exist beside attributes, instead of preserving all line breaks of all non-empty lines. The idea was behind it is that in some cases, it may be beneficial to remove newlines while keeping some. For example, in this case:
it would be nice to have it formatted to:
and
formatted to
How does this sound? |
This sounds amazing. Yes formatting line breaks in some cases such as described seems acceptable. |
Great, thank you for the feedback. I realize that the gif is a bit misleading since the attribute names are all aligned since the tab size is 4 spaces. PR eclipse-lemminx/lemminx#772 will indent the attribute names depending on the element's indentation and will not align attribute names for the moment. I created a new issue for attribute aligning here: #272 |
Can we close this issue? |
Closing as we provided xml.format.preserveAttributeLineBreaks |
Hi
Context
A big XML file with long lines, line breaks are used to keep lines visually undestandable (and max 120 chars). Using the formatter, line breaks are removed resulting in extremely long lines (300 chars+). In the other hand, a line break per attribute is not a solution.
Question
How to prevent line breaks refactoring during formatting ? -> "Keep my line breaks"
Thanks
The text was updated successfully, but these errors were encountered: