格式化我的代码Ctrl + Shift + f 这就是我的代码看起来的样子
if (item == null) {}
是否可以将其格式化为
if(item == null) {}
谢谢,
答案 0 :(得分:5)
你可以去Window>偏好> Java>代码风格>格式化器>编辑>并取消选中“打开括号前”选项。
答案 1 :(得分:2)
您可以在Eclipse上配置formatting profiles。
只需转到Eclipse首选项> Java>代码风格>格式化。
正如另一个答案所指定的那样(该死的,这很快!),当您选择before opening parenthesis
时,您会在control statements > 'if else'
复选框上找到您要查找的特定选项white space
对话框中的edit profile
标签。
查看这些资源: