Community
Participate
Working Groups
Build ID: M20080911-1700 Steps To Reproduce: 1. Set maximum line length in formatter preferences 2. Enable wrapping 3. Apply source/format to for-loop to be supplied below. 4. Resulting line is too long. More information: for (Element el = XDOMUtil.getFirstChildElementNS(constraintEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil.getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { } Note that this is a problem for those of us who use checkstyle, or a related tool, to enforce a maximum line length. It would be really good if the formatter could produce for (term a; term b; term c) { but I'll take anything that respects the line length.
The Eclipse built-in profile already set the maximum line length to 80, did you change this default value while formatting your snippet?
Yes we changed it. However, the point is this, for any length we set it to, the formatter will make lines longer than that length.
Hmm, using 3.5.0 and I format the following snippet using Eclipse built-in profile: public class X { void foo() { for (Element el = XDOMUtil.getFirstChildElementNS(constraintEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil.getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { } } } And I get the following output: public class X { >> void foo() { >> >> for (Element el = XDOMUtil.getFirstChildElementNS(constraintEl, >> >> >> >> XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil >> >> >> >> .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { >> >> } >> } } I've replaced the tabulation character with '>> ' and space with '.' to make lines fit into the bugzilla comment... I observed that the max line length of 80 characters is honored in this peculiar case. Is it the split of the lines which does not fit your expectation or is there something I'm missing?
As there is no answer on my last comment, I close this bug as worksforme for the while. Feel free to reopen if you have more information about this, thx
Verified for 3.6M6