开发者

eclipse conditional formatting braces only for multiple lines

开发者 https://www.devze.com 2023-02-25 18:45 出处:网络
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.

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

精彩评论

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