-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Indentation: fix line wrap hanlding #2950
Comments
@rnveach , please append whole-code after auto-formatting from IDEs to be 100% exact what is going on. References to lines numbers helps a bit but still obscure. |
NetBeans
IntelliJ:
Eclipse:
|
We do not force user linewrap in certain point or single statement per line!!
We do not force user linewrap in certain point or single statement per line.
Indentation 30 is incorrect for sure. Netbeans want to indent wrapped lines. Eclipse and Intelij are not indenting wrapped method signature. |
I disagree.
I will work on this.
Eclipse can be customized to duplicate this if you play around with its customizations. |
As an example, are you expecting var6 and the next statement (var7) to not be separated as all the IDEs are breaking them apart? In NetBeans, I turned all wrapping to |
I am closing this since the commit was merged. |
yes, commit is merged. |
Line wrapping currently handles instances wrong when it's starting node isn't the first on the line. I mentioned this in another issue where I wanted to use line wrapping, but had to make weird adjustments because I couldn't guarantee the node was the first on the line.
If the node isn't the first on the line, line wrapping thinks it is and therefore uses that indentation as the base for the next wrapped lines. It should instead use either the current line's indentation or take as input the expected indentation from previous checks.
All the cases above are wrapped correctly with 4 spaces, even though 2 (line 7 , line 10) don't follow the one statement per line rule.
Default Auto Formatters:
I used the same code listed above, with comments and all, with the IDE's default auto format options.
IntelliJ: splits lines 2, 6, 9 into separate lines (think of one statement per line rule). Line 3 and 7 keep their +4 indents after the split, line 10 is indented the same as line 9.
Eclipse: only line 2 is split into separate lines, the rest stay the same. Line 3 keeps its +4 indent after the split, lines 7 and 10 are indented to the same position as their previous line.
NetBeans: splits lines 2 and 6 into separate lines, the rest stay the same. Lines 3, 7, and 10 keep their +4 indent.
The text was updated successfully, but these errors were encountered: