Community
Participate
Working Groups
Build ID: I20080330-1350 Steps To Reproduce: XML formatter removes empty lines, and there is no way to prevent it. This has not been a problem on Eclipse 3.3. More information: Ubuntu Gutsy, Java 1.5.0_13-b05
Created attachment 97672 [details] patch This patch should address the XML formatter not keeping blank lines. Also added a junit test case to test keeping blank lines, as well as fixed up some preferences for some of the old test cases that expected blank lines would be cleared, when by default, they are not.
The patch fixes empty lines between tags, but if you have empty lines in tag content/within a start & end tag, then they will always be removed.
Bumping to 3.0.1 pending addressing of issue from comment 2.
Created attachment 105757 [details] patch for xml content This patch should address keeping blank lines in XML content as it was in previous versions of WTP. It will also fix a problem where the blank lines around comments were always being kept, and comments were not properly indented when on their own line.
The patch looks pretty good, but I found a case where formatting an already formatted file will mark the file as dirty. 1. create an xml file with the following: <tag> content </tag> 2. format and save 3. format again I expected the file to not be dirtied since it was already formatted, but that was not the case. I believe there needs to be some logic added in the collapseAndIndent method to check that if the existing whitespace is already going to be the same as what you were going to replace the whitespace with, then there's no need to replace. Other than that, patch looks good. Especially with unit tests. If you want, I can change my review to a + and get this committed for 3.0.1 and then open a new bug on this one last issue. Or we can keep this bug open while you work on the last issue. I'm fine with either way.
Created attachment 106343 [details] patch to keep from dirtying unchanged regions Added logic to collapseAndIndent so that if the correct indenting is equivalent to the existing whitespace, no change is made.
Created attachment 106357 [details] patch to keep from dirtying unchanged regions The previous patch had an extra test file in. Removed it.
Created attachment 106359 [details] third time's a charm Sorry left a testing System.out in there.
*** Bug 239678 has been marked as a duplicate of this bug. ***
Okay, fix looks good.
Adding Nitin for review for 3.0.1 patches.
*** Bug 241025 has been marked as a duplicate of this bug. ***
released
Verified in M-3.0.1-20080724062240.
*** Bug 247042 has been marked as a duplicate of this bug. ***