【问题标题】:Prevent Eclipse from Adding a Space After Comments防止 Eclipse 在注释后添加空格
【发布时间】:2015-10-18 06:18:40
【问题描述】:

我正在使用 Doxygen 和 eclipse 来记录我正在处理的 Java 项目。目前,代码格式化程序在 cmets 之后插入一个空格,这给记录类变量带来了困难。比如下面的代码

public class Example {
    /// this is the description of the variable
    public String var = "hellooooo world";
}

被“更正”为

public class Example {
    // / this is the description of the variable
    public String var = "hellooooo world";
}

这会破坏我正在记录的变量的文档。显然我可以简单地关闭代码格式化程序,但它真的很有用。如果可能,我只是想避免脚本或查找/替换调用。我认为这是一个常见问题,但到目前为止我一直找不到任何东西。

【问题讨论】:

  • 那 /** 评论块呢?看起来更好吗?
  • 这是一个解决方案,但不是最可取的。

标签: java eclipse doxygen


【解决方案1】:

最简单的方法是为 Java 添加新的代码样式格式化程序。为此,请转到:preferences -> Java -> Code Style -> Formatter

然后您需要创建一个新的格式化程序配置文件(无法编辑内置配置文件)。在新的格式化程序配置文件窗口中有一个用于注释格式化的选项卡。

【讨论】:

  • 感谢您的帮助。在 cmets 选项卡下,我没有看到在 cmets 开头添加空格的选项。我错过了吗?
猜你喜欢
  • 2016-01-01
  • 2011-10-23
  • 2019-09-16
  • 2017-03-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-07
  • 2014-09-10
相关资源
最近更新 更多