【问题标题】:Intellij IDEA Kotlin - How to comment in same column?Intellij IDEA Kotlin - 如何在同一列中发表评论?
【发布时间】:2019-01-05 13:52:17
【问题描述】:

我希望在使用 Ctrl+/ 时使用 cmets,它 适用 用于 Java 但不适用于 Kotlin 代码,我已按照 @ 中所述完成987654321@(注:我用的是Intellij Ultimate 2018.2

要在 Java 中配置注释行为的设置,请使用注释代码部分中的选项,位于文件 | 代码生成选项卡上。设置/首选项 |编辑 |代码风格 | Java。

Commented Code 部分标记为Add a space at comment start, 我在Kotlin Code Style中找不到任何评论代码配置

例如Kotlin:

fun main(args: Array<String>) {
    // Desired comment
//    After Using Ctrl+/
}

但在Java工作:

public class Sample {
    public static void main(String[] args) {
        // Works fine using Ctrl+/
    }
}

【问题讨论】:

  • 你找到解决这个问题的方法了吗?
  • 仍未解决

标签: java intellij-idea kotlin comments


【解决方案1】:

Wrapping and Braces 使用键盘快捷键时,此选项对我不起作用,设置位于:

Editor -&gt; Code Style -&gt; Kotlin -&gt; Code Generation

并取消选中该选项:Line comment at first column,完成!

【讨论】:

    【解决方案2】:

    我正在使用 IntelliJ IDEA 2018。3,但我相信这在 IDEA 2018.2 中仍然可用。

    在设置中,Editor -> Code Style -> Kotlin -> Wrapping and Braces,在Keep when reformatting下,un勾选Comment at first column

    更新:我发现这不是在编码......但发生在Code -> Reformat Code :-(

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多