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

标签 eclipse formatting comments

我有 (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.
 */

这对我也有用。

关于eclipse - 如何防止 Eclipse 格式化程序弄乱带有文本符号的注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12578398/

相关文章:

netbeans - Netbeans 中的自动换行注释

java - Eclipse 在尝试显示 rt.jar 中的类的 Javadoc 时超时

java - Eclipse 中的 "java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy"

android - 将 Android 库添加到项目中?

date - 为什么我需要在Grails中解析日期?

javascript - 避免计算代码中的注释

eclipse - 尽管 svn :ignore flag,Eclipse 上的 SVN 仍然尝试同步 eclipse .settings 目录

jsp - 如何将变量设置为小数点后 2 位

WPF:更改给定容器中所有控件的字体

php - 如何注释包含 */的字符串