怎么样:
/**
* The quick brown fox jumped over the lazy dog.
*
* <p>Notes:
* <li>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.</li>
* <li>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.</li>
*/
然后在 Windows -> Preferences -> Java -> Code Style -> Formatter -> Edit... -> Comments 中打开“Format HTML tags”
这仍然会导致线宽断线。
编辑:
我使用了以下块注释:
/*
* 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 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. The quick brown fox jumped over the lazy dog.
*/
我正在为 Java EE 使用 Eclipse Neon.3,我的 Formatter cor 注释设置为 150 的宽度,并选择了“从不加入行”。格式化此块注释会给我以下结果,我认为这是您可能想要的(尽管我知道您不想“从不加入行”)。
/*
* 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
* 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.
* The quick brown fox jumped over the lazy dog.
*/
只有1个小问题。当我在第一个项目符号列表中添加更多文本然后再次格式化时,我得到以下结果。
/*
* 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
* SOME MORE TEXT TO WRAP
* 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.
* The quick brown fox jumped over the lazy dog.
*/
那是因为我告诉格式化程序“不要加入行”。当我取消选择“从不加入行”时,我显然会得到与您相同的结果。