Tuesday, November 5, 2013

Leveraging task-tags in Eclipse

This is one of my favorite tricks you can use to improve Eclipse. It provides a very nice way of managing your task tags in a large multi-author codebase, where TODOs typically count in the hundreds, if not thousands, and in doing so making the Task View-feature into a very powerful tool for tracking your own development.

First, set up templates for your tags, including a ${user} and ${date} reference.

First, set up templates for your task tags, on the format
// TODO (${user} ${date}) - ${cursor} 
// FIXME (${user} ${date}) - ${cursor}

You can easily insert these by typing todo and hitting <ctrl><space>. This is useful in that it is possible to keep track of who is responsible for the task tag, but the real magic comes in the next step.

Open the Tasks view, click the little downward-pointing triangle-button in its upper right corner, and select "Configure Contents". You want a new filter based on your user name appearing in the contents of the task tag.

Configuration example

When this is all set-up, Eclipse will track all of your task-tags. 

Instant task-tracking

Making a habit of using these improved tags provides an immensely powerful way of getting around the code, not only does it allow you to keep track of your margin-scribbles in the code, the tags also serve as task-oriented bookmarks. If you just plop one down when a potential issue springs to mind, you will remember it later.

I'm leaning toward preferring the use of task tags to the actual bookmark feature in eclipse, which I find much clunkier. The feature has also largely superseded the practice of attaching post-its to my screen.

As a final note, you can make Eclipse recognize additional tags in the settings: Java>Compiler>Task Tags. For example, I also use "TEST" to mark code that needs additional unit tests, and "STUB" to mark unwritten functions (this is purely as a bookmark).

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete