【问题标题】:Why does eclipse always wrap after @param myParameter in JavaDoc?为什么eclipse总是在JavaDoc中的@param myParameter之后换行?
【发布时间】:2012-12-04 11:53:41
【问题描述】:

我有这段 Java 代码:

/**
 * Initializes the Levenshtein Object with the two given words.
 * 
 * @param word1 first word
 * @param word2 second word
 */
public Levenshtein(String word1, String word2) {
    this.word1 = "." + word1.toLowerCase();
    this.word2 = "." + word2.toLowerCase();
    this.distance = new int[this.word2.length()][this.word1
            .length()];
}

如果我按 Ctrl + Shift + F,我会得到:

/**
 * Initializes the Levenshtein Object with the two given words.
 * 
 * @param word1
 *            first word
 * @param word2
 *            second word
 */
public Levenshtein(String word1, String word2) {
    this.word1 = "." + word1.toLowerCase();
    this.word2 = "." + word2.toLowerCase();
    this.distance = new int[this.word2.length()][this.word1
            .length()];
}

为什么 Eclipse 做这种婴儿车换行?如何切换它(不完全切换到 JavaDoc)?

这些是我目前在 eclipse 3.5.2 (Galileo) 中使用的 Formatter settings

【问题讨论】:

    标签: eclipse autoformatting


    【解决方案1】:

    窗口 > 首选项 > Java > 代码风格 > 格式化程序
    (编辑)> 评论
    复选框:@param 标签后的新行

    见于朱诺 (4.2)。

    【讨论】:

    • 嘿,这也让我很烦(虽然我选择性地使用 Ctrl+F,所以我很少受此影响),所以谢谢你的问题! :-)
    • XML 中的 <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
    猜你喜欢
    • 1970-01-01
    • 2012-07-09
    • 1970-01-01
    • 2010-10-15
    • 2012-07-06
    • 2011-05-31
    相关资源
    最近更新 更多