在格式化代码时,使语句彼此相邻

时间:2018-10-29 11:22:17

标签: java android-studio settings android-studio-3.0 code-formatting

在完成编码后,我倾向于使用 Alt + Ctrl + L 重新格式化我的代码,但我不想在写语句彼此相邻。

这应该保持原样。

setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar(); assert actionBar != null;

但这应该换行。

{ foo();

有选择吗?

1 个答案:

答案 0 :(得分:1)

找到了!

Settings
  Editor
    Code Style
      Java
        Wrapping and Braces
          Keep when reformatting
            Multiple expressions in one line <= tick this