Eclipse has a cool feature which might not be known to everyone: the ‘To-Do’ (or Tasks) List which keeps track of what I have to do:
The name ‘Tasks’ for that view is somewhat misleading, as it has nothing to do with tasks of an operating system. That view is very powerful as it collects to-do’s, bug locations or anything I want in a central place and view.
If that view is not open, use the menu Window > Show View to open it:
One easy usage of this view is to have markers in the source comments like this one:
/* todo this is a to-do */
Eclipse parses the source files in the background and it will show up in the Tasks list like this:
The cool thing is that I can double-click on the entry and it will jump to the source/line.
💡 I’m using such ‘TODO’ for my labs and classes to have students be able to jump directly to the source line.
It accepts different style of markers, and they can be in C and C++ comments:
/* TODO this is the normal way */ /* todo this is another to-do */ /*! \todo this is a doxygen to-do */ // TODO this is a C++ to-do comment
It adds markers to the source view too and I can easily spot them:
By default, the following task tags in comments are recognized
They are all case in-sensitive by default. The task tags can be configured under Window > Preferences > C/C++ > Task Tags. There I can add/remove tags, assign a priority:
With the context menu in the view I can add ‘traditional’ to-do list items:
Then I can provide a description with a priority:
Then they get listed too, and I can check the check mark to have an item completed:
‘Tasks’ markers are a good way to annotate source files with to-do’s or bug entries. The Tasks view lists them and I can use them as shortcuts to the source place.
💡 There are other advanced usage of markers in combination with version control systems and team collaboration tools: that way assignments can be put out for the teams to work on. But that would be subject of a different article.
Happy Tasking 🙂
- Tasks View in Eclipse: http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fctskview.htm
Thanks for your articles. I read some of them and found it realy helpful. I also love the task functionality, but I just discovered, that tasks are NOT saved within the project. I copied a folder from the workspace and imported it later, but now all tasks are gone. Do you know how to export/import them???
do you have the TODO in your sources? If yes, and if they are part of a project,t they should show up on the list of tasks.
When I use the TODO then it works. But then it´s just a usual comment being parsed by Eclipse and interpreted as a task.
But I like to create tasks by right-clicking Add Task… better, as they don´t show up in the code. But those tasks disappear when I import the project.
if you don’t have it in the source, it is not stored in the project, it is stored in the Eclipse framework (basically the workspace metadata).
You would need to store it in the project files/sources, if you want to have it associated with the project.
I don’t know of another way.