【问题标题】:How to apply indentations settings for comment line (IntelliJ IDEA / Android Studio)如何为注释行应用缩进设置(IntelliJ IDEA / Android Studio)
【发布时间】:2020-08-10 13:05:27
【问题描述】:

我当然知道如何使用行注释快捷方式,ctrl + /,但由于某种原因,注释从行尾开始。

如果我从这段代码开始:

if (something) {
    return 5;
}

使用 IntelliJ 的快捷方式,我最终得到:

if (something) {
//    return 5;
}

但我希望事情看起来像这样:

if (something)
    // return 5;
}

有什么方法可以在 IntelliJ 中进行配置?我尝试更改目标语言的代码语法规则,但没有任何改变。

【问题讨论】:

    标签: android-studio intellij-idea ide


    【解决方案1】:

    可以在(Settings / Preferences -> Editor -> Code Style -> Java -> Code Generation)中更改此设置

    选项:

    • Line comment at first column.

    • Block comment at first column.

    它应该适用于 Android Studio 和 IntelliJ IDEA。

    【讨论】:

      猜你喜欢
      • 2011-07-13
      • 2012-11-03
      • 2012-07-14
      • 1970-01-01
      • 1970-01-01
      • 2019-12-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多