【问题标题】:Format code to align with its own subsection clause格式化代码以与其自己的小节条款保持一致
【发布时间】:2019-02-20 09:44:30
【问题描述】:

目前使用 IntelliJ 2018.2.3

应选中/取消选中代码样式(或其他任何地方)中的哪些选项以实现以下行为?

预期行为:

@Override
public boolean equals(Object other) {
    return other == this // short circuit if same object
            || (other instanceof UniquePersonList // instanceof handles nulls
               && this.internalList.equals(((UniquePersonList) other).internalList)); <--
}

当前行为

@Override
public boolean equals(Object other) {
    return other == this // short circuit if same object
            || (other instanceof UniquePersonList // instanceof handles nulls
            && this.internalList.equals(((UniquePersonList) other).internalList)); <--
}

目前,每次我自动格式化代码时,它都会将&amp;&amp; 转换为与|| 对齐。但是很明显&amp;&amp;属于第二个子句的小节。

【问题讨论】:

    标签: intellij-idea code-standards


    【解决方案1】:

    尝试代码风格 |爪哇 |包装和大括号 |二进制表达式 | 多行时对齐

    【讨论】:

      猜你喜欢
      • 2019-08-21
      • 2021-12-18
      • 2021-08-24
      • 2011-02-07
      • 1970-01-01
      • 2019-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多