Search code examples
eclipsetemplatesjavadoceclipse-templates

How to add correct indentation to code from Eclipse templates


I'm trying to generate a template that adds a List to a Javadoc. My current template (name ul) is:

<ul>
<li>${cursor}</li>
<li></li>
</ul>

When typing ul and hitting Ctrl + Space in the JavaDoc of a method, this results in

  /**
   * <ul>
<li></li>
<li></li>
</ul>
   */

I'd like to have

  /**
   * <ul>
   * <li></li>
   * <li></li>
   * </ul>
   */

Is there a way to copy all characters that are before the ul and add them to each line?


Solution

  • This is a known bug in Eclipse: https://bugs.eclipse.org/bugs/show_bug.cgi?id=36381

    Unfortunately as it is nearly a decade old, I wouldn't expect it to be fixed anytime soon.