首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >使Eclipse的Java代码格式化程序忽略块注释

使Eclipse的Java代码格式化程序忽略块注释
EN

Stack Overflow用户
提问于 2009-06-21 22:25:33
回答 5查看 38.5K关注 0票数 81

有没有办法让Eclipse内置的Java代码格式化程序忽略注释?每当我运行它时,它都会变成这样:

代码语言:javascript
复制
    /*
     * 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
     */

如下所示:

代码语言:javascript
复制
    /*
     * 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。

EN

回答 5

Stack Overflow用户

发布于 2013-01-03 22:00:49

另一种可能是在Javadoc中使用HTML:

代码语言:javascript
复制
/**
 * <pre>
 *    this
 *   is
 *      kept
 *  as
 *    is
 * </pre>
 */

至少这是我倾向于在源代码注释中嵌入ASCII-art的方式:)

票数 19
EN

Stack Overflow用户

发布于 2010-02-11 01:57:04

<pre> </pre>标记将特定文本括起来。

票数 9
EN

Stack Overflow用户

发布于 2009-06-21 22:31:51

在Eclipse3.4中: Preferences,Java->Code Style->Formatter,然后编辑profile、comments选项卡。这里有一堆控制注释格式的选项。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1024886

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档