有没有办法让Eclipse内置的Java代码格式化程序忽略注释?每当我运行它时,它都会变成这样:
/*
* PSEUDOCODE
* Read in user's string/paragraph
*
* Three cases are possible
* Case 1: foobar
* do case 1 things
* Case 2: fred hacker
* do case 2 things
* Case 3: cowboyneal
* do case 3 things
*
* In all cases, do some other thing
*/
如下所示:
/*
* PSEUDOCODE Read in user's string/paragraph
*
* Three cases are possible Case 1: foobar do case 1 things Case 2: fred
* hacker do case 2 things Case 3: cowboyneal do case 3 things
*
* In all cases, do some other thing
*/
我已经尝试过Windows > Preferences > Java > Code Style > Formatter设置,但找不到一个可以保留注释格式的设置。我使用的是Eclipse 3.4.0。
发布于 2013-01-03 22:00:49
另一种可能是在Javadoc中使用HTML:
/**
* <pre>
* this
* is
* kept
* as
* is
* </pre>
*/
至少这是我倾向于在源代码注释中嵌入ASCII-art的方式:)
发布于 2010-02-11 01:57:04
用<pre> </pre>
标记将特定文本括起来。
发布于 2009-06-21 22:31:51
在Eclipse3.4中: Preferences,Java->Code Style->Formatter,然后编辑profile、comments选项卡。这里有一堆控制注释格式的选项。
https://stackoverflow.com/questions/1024886
复制相似问题