Search code examples
javaeclipsejavadoc

Eclipse: How to have the code formatter insert tabs after javadoc tags


I'd like to have:

    /**
 * @param from  a point belonging to the map
 * @param to    a point belonging to the map
 * @return      a list of weighted edges on the shortest path from
 *                  {@code from} to {@code to}
 */

But eclipse gives me:

/**
 * @param from a point belonging to the map
 * @param to a point belonging to the map
 * @return a list of weighted edges on the shortest path from {@code from}
 *         to {@code to}
 */

Is there a way to change this ?


Solution

  • Sure, in eclipse, go to Windows, preferences, Java>Code Style>Formatter, and click on edit. Then look for the comments you want to modify and add a tab.

    That said, are you sure you want to do this? Please consider the guidelines, not to mention that now or in the future, some parsers might fail to find your javadoc, and some programmers might be very annoyed with you ;)

    Edit: Oh :/ I'm afraid you're right; I was thinking of Java>CodeStyle>CodeTemplates, which will put whatever you want when a method/class is created. This, however, will not be respected by the autoformatter :(