23

Fairly straight forward question here. Has anyone figured out how to do a TODO: comment in Eclipse that spans multiple lines? I cannot for the life of me get it to work.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Will Madison
  • 3,065
  • 2
  • 22
  • 19
  • 8
    Hmm, I would just continue the comment in the next line (without TODO). This will not be included in the task list, but a click there brings me to the source line, where I can read the full text. Is there a specific reason you need more? – Paŭlo Ebermann Jun 17 '11 at 01:55
  • 1
    Cool thanks everybody for your input that's what I essentially ended up doing. Putting a high level summary on the same line with the TODO then a more detailed comment right below it about what it will entail. Thanks again! – Will Madison Jun 17 '11 at 14:26
  • /** * TODO This is * a multiline todo * comment */ – Ravisha Jul 27 '11 at 04:13

7 Answers7

10

I assign a short title/explanation to the TODO. This title will be picked up by your IDE and put in the task list for reference. Then underneath I describe my TODO at length.

The first line will be nicely highlighted in your code, so you can easily recognize your to-do's inline too.

/**
*   TODO: Short explanatory title
*   Here I start a more lengthy description.
*   This can consist of as many lines as you want.
*/
therebelcoder
  • 929
  • 11
  • 28
  • Isn't `/**` typically reserved for JavaDoc comments? Why not use `/*`? – Stevoisiak Apr 21 '17 at 20:44
  • 1
    @StevenVascellaro `/*` is called a [begin-comment delimiter](https://en.wikipedia.org/wiki/Javadoc#Structure_of_a_Javadoc_comment) and has no special meaning (apart from that it starts a comment). `/**` is known as a [DocBlock](https://en.wikipedia.org/wiki/Docblock) or [DocComment](https://phpdoc.org/docs/latest/glossary.html#term-8). Eclipse [uses Javadoc](https://wiki.eclipse.org/Javadoc) to generate the API docs, whereas Javadoc [follows the "doc comment"](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#comments)-format to parse and prepare the code. – yckart May 28 '17 at 01:41
5

Please try with below lines,

    /**
     * <pre>
     * TODO : You can write very long line here, which will not truncate in task desc.
     * </pre>
     */
Vishal Zanzrukia
  • 4,902
  • 4
  • 38
  • 82
  • if it works for you, you should upvote it so it can be useful to others. :) – Vishal Zanzrukia Jul 29 '15 at 06:55
  • This worked for me in Eclipse with Python/PyDev. I just used the Python syntax for a multi-line comment, rather than single and it worked! Thanks for the answer...from the future. – Hildy May 16 '18 at 20:24
0

You can create multi line TODO comments like this:

/**
* 
*         TODO This is the first line
*         This is the second line of todo comment
*/
Aleks
  • 4,866
  • 3
  • 38
  • 69
0
 *
 * @TODO this is the first line<br>this is the second line
 * 

Will display with 2 Lines in the tooltips since i've used <br> ;)

greenseed
  • 509
  • 5
  • 10
0

Go to preferences → Java → Code style → Formatter → New → give any name → uncheck block commenting.

double-beep
  • 5,031
  • 17
  • 33
  • 41
  • 3
    Welcome to Stack Overflow! While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Yunnosch Sep 21 '21 at 11:11
0

I don't know if this might help you, but you can also add you own custom task tags under Preferences>Java>Compiler>Task tags. That way you can seperate the default(auto-generated) tags from your own tags which you might find more important to fix then the standard TODO tags.

You can then also configure the Tasks view to only display your own custom tags for instance...

bvanvelsen - ACA Group
  • 1,741
  • 1
  • 14
  • 25
-1

It seem Eclipse does not mark TODO as comment, it looks for the word "TODO".

So it seem like you have to something like (for now at least):

// TODO:
// TODO:
// TODO:

or

/* TODO:
 * TODO:
 * TODO:
 */

for multi-line TODOs

YTKColumba
  • 4,023
  • 4
  • 19
  • 21
  • 5
    This creates 3 separate TODO items in the Tasks list. I don't think that's what the OP intended. – Sameer Oct 29 '13 at 01:13