开发者

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:

Eclipse does not format this if statement correctly

Click on Formatter link to edit settings for Formatter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜