ein*_*ica 21 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.
*/
Run Code Online (Sandbox Code Playgroud)
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.
*/
Run Code Online (Sandbox Code Playgroud)
我如何将代码格式化程序保留为原样保留项目符号列表,同时还处理注释?
备注:
Var*_*har 39
这个答案说你在开幕后就加了一个炒作/*
,即:
/*-
* 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.
*/
Run Code Online (Sandbox Code Playgroud)
这对我也有用.
Zol*_*lyi 13
您的问题的答案可能与此处相同:如何为Java代码的某些部分关闭Eclipse代码格式化程序?
从Eclipse 3.6开始,您可以使用
// @formatter:off
...
// @formatter:on
Run Code Online (Sandbox Code Playgroud)
注释以禁用代码格式.
更新:
或者,您也可以更改首选项中的注释设置:在Java /代码样式/格式化程序中编辑格式化程序设置,并在"注释"页面中查看以下设置:
顺便说一句,这种手动列表不会转换为生成代码中的列表.出于这个原因,使用html列表可能是有意义的.
我知道这个问题很老,但我也可以看到没有人给出满意的答案。
这解决了我的问题。
去Preference->Java->Code Style->Formatter
。在这里,转到您正在使用的任何格式化程序样式的编辑。在编辑对话框中,您将找到一个复选框Enable Block Comment Formatting。取消选中此项。像我一样更改个人资料名称。申请并确定。你完成了。
希望这可以帮助。
您可以更改 Eclipse 格式化注释的方式,并对块注释进行特殊处理。
转到窗口 - >首选项。Java > 代码风格 > 格式化程序。单击“新建”以创建新模板。然后在“注释”选项卡下禁用块注释格式。
然而,这永远不会对块注释执行任何格式化。
按照 Bananeweizen 所说的,您还可以用<pre></pre>
标签包裹相关的评论块,将每个制表符和空格保留在其位置:
/*
* The quick brown fox jumped over the lazy dog.
*
*
*<pre>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.</pre>
*/
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
16539 次 |
最近记录: |