Eclipse does not format this if statement correctly
This should be easy to开发者_高级运维 answer:
I have Eclipse set to wrap Java code over 80 chars to respect my margin.
This code never wraps:
if (expressionItem.type.isTypeCompatibleWith(containingNameLink.type) == false) {
reportParsingError("expression type incompatible with containing "
+ "context.");
}
Question: how do I set my code formatter preferences so that the margin is respected?
Did you press CTRL + SHIFT + F (or right click > source > format) ? Here it works fine. The code is not automatically formatted as you type, you need to tell eclipse to format it.
Click Windows > Preferences
. Go to Java > Editor > Save Action
Enable Perform the selected action on save then enable Formatt source code option.
Refer below pic:
Click on Formatter link to edit settings for Formatter.
精彩评论