eclipse - 如何防止 Eclipse 格式化程序弄乱带有文本符号的注释?

我有 (Java) 注释,例如:

/* 
 * The quick brown fox jumped over the lazy dog.
 *
 *
 * Notes:
 * - The quick brown fox jumped over the lazy dog. The quick brown fox
 *   jumped over the lazy dog. The quick brown fox jumped over the lazy
 *   dog.
 * - The second quick brown fox jumped over the lazy dog. The quick brown
 *   jumped over the lazy dog. The quick brown fox jumped over the lazy
 *   dog.
 */

Eclipse 自动格式化程序会正确设置注释行宽,但会这样做:

/*
 * The quick brown fox jumped over the lazy dog.
 * 
 * 
 * Notes: - The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy
 * dog. The quick brown fox jumped over the lazy dog. - The second quick brown fox jumped over the
 * lazy dog. The quick brown jumped over the lazy dog. The quick brown fox jumped over the lazy dog.
 */

代码格式化程序如何让项目符号列表保持原样,同时仍处理注释?

注意事项:

  • 我不想关闭加入评论的行,因为我确实希望我的评论行适合最大长度。因此,关闭行连接、关闭 Javadoc 注释的格式设置或暂时暂停自动格式化,都是 Not Acceptable 解决方案。
  • Possibly related question .

最佳答案

This answer表示您在开头 /* 之后添加了一个连字符,即:

/*- 
 * The quick brown fox jumped over the lazy dog.
 *
 *
 * Notes:
 * - The quick brown fox jumped over the lazy dog. The quick brown fox
 *   jumped over the lazy dog. The quick brown fox jumped over the lazy
 *   dog.
 * - The second quick brown fox jumped over the lazy dog. The quick brown
 *   jumped over the lazy dog. The quick brown fox jumped over the lazy
 *   dog.
 */

这对我也有用。

https://stackoverflow.com/questions/12578398/

相关文章:

html - 修复 Visual Studio 中 aspx 文件的格式?

c# - 是否有一种文化安全的方法来获取带前导零的 ToShortDateString() 和 To

html - 在 Vim 中格式化和缩进 HTML

java - Eclipse 的 Java 编辑器可以做软换行吗?

c# - 如何在 C# 中将 int 格式化为货币?

ruby-on-rails - 格式化时间戳

java - 如何在 Java 中使用 String.format()?

javascript - 使用javascript将小数位添加到数字中

javascript - 阻止 ReSharper 将 JavaScript 函数参数放入新行

php - php中的PDF导出