开发者

eclipse conditional formatting braces only for multiple lines

Any way to configure eclipse to only wrap if statements in braces if it is multiple lines, and leave alone single line statements? e.g.

if (x =开发者_运维知识库= y) z();

if (x == y){
    z();
}


How would it know? If you have a default of always using braces for multiple or single, you will avoid errors of putting in code that is supposed to be part of the if statement but ends up not.


Use can use //formatter:off and //formatter:on tags to switch on or switch off formatting in a given range of code lines.

Refer this post: How to use eclipse's code formatter to remove new lines after 'case'?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜