1

我正在使用 eclipse 代码格式化程序,并且我已将最大行长度设置为 120。例如,如果赋值语句长于 120 个字符

private Map<Instruction, LocalRegisterAssignmentInformation> instructionRegisterMap = new IdentityHashMap<Instruction, LocalRegisterAssignmentInformation>();

我希望格式化程序包装这一行并使语句如下所示:

private Map<Instruction, LocalRegisterAssignmentInformation> instructionRegisterMap
  = new IdentityHashMap<Instruction, LocalRegisterAssignmentInformation>();

但是格式化程序似乎没有包装它。我尝试在 eclipse 格式化程序配置文件设置中查找相关选项,但找不到任何选项。

4

1 回答 1

1

编辑您的 Java 格式化程序配置文件,如下所示:

  1. 换行中选择表达式 > 分配
  2. 必要时将换行策略设置为Wrap
  3. 选中复选框Wrap before operator
于 2018-05-04T08:55:33.377 回答