【问题标题】:How to prevent eclipse formatter from removing "alignment spaces" in block comments?如何防止 Eclipse 格式化程序删除块注释中的“对齐空格”?
【发布时间】:2019-10-07 16:03:18
【问题描述】:

我们使用 google 的“Java 风格”的(略微采用)版本,只需在 eclipse 中导入相应的 XML(来自 here)。

这很好用,但我们发现块 cmets 存在一个烦人的问题。

我们的文件确实有一个生成的版权标题,如下所示:

/* some text followed by some spaces      */
/* so that all lines are equally spaced   */

当使用google风格的xml时,上面变成了

/* some text followed by some spaces */
/* so that all lines are equally spaced */

使用Eclipse [built-in] 格式化程序进行格式化时,不会删除空格!

我仔细查看了google的xml文件,遇到了这一行:

<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" false="true"/>

但是,可惜的是,将该行更改为使用 false 并没有改变任何内容。

问:如何修改 google 风格的 XML 文件,使空格保持在块 cmets 内?

【问题讨论】:

    标签: java eclipse formatter


    【解决方案1】:

    Eclipse [内置] 样式已关闭“启用标题注释格式”(XML 中的 org.eclipse.jdt.core.formatter.comment.format_header 值)。所以它只留下标题注释。

    【讨论】:

    • 正是我想要的!感谢您的快速回归!我很高兴能为您的 100K 之路做出贡献;-)
    猜你喜欢
    • 2016-01-01
    • 2019-09-16
    • 2018-05-15
    • 1970-01-01
    • 2015-09-27
    • 2017-08-09
    • 2012-09-16
    • 2015-10-18
    • 2011-10-23
    相关资源
    最近更新 更多