26

I'm trying to track TODOs in Android studio.

Is there a way to mark them 'complete' without simply deleting them?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
NonCreature0714
  • 5,744
  • 10
  • 30
  • 52
  • 5
    Change the word `TODO` to `DONE`? – Elliott Frisch Dec 03 '15 at 02:56
  • 1
    @ElliottFrisch This is an answer I think. Simple yet complete. – Ross Dec 03 '15 at 03:05
  • @ElliottFrisch, a good suggestion. (And that's what I'll probably end up doing.) But since TODO is special comment, I was hoping there is another special comment or some means of handling TODO completion. – NonCreature0714 Dec 03 '15 at 03:06
  • @Ross, agreed, it is a simple, complete answer. – NonCreature0714 Dec 03 '15 at 03:06
  • @ElliottFrisch but then it wouldnt be tracked. – NullByte08 May 28 '20 at 17:26
  • @NullByte08 Version control is for tracking changes over time and task management tools are for tracking tasks; what is the purpose of a `TODO` comment? What purpose to a `DONE` comment serve? Basically, what problem are you really trying to solve? – Elliott Frisch May 28 '20 at 17:30
  • @ElliottFrisch There is a `TODO` option in Android Studio's tool window bar, which tracks all the TODOs. When you mark the comment as done, the TODO comment is removed from that list. Dario's answer gives us the option to mark the comment as done so it can be easily viewed in that list just besides other TODOs. – NullByte08 May 28 '20 at 17:36
  • Its just easier for the user nothing much. – NullByte08 May 28 '20 at 17:39
  • Can't we use the symbol `[x]` just before a TODO to mark it as done just like we do in GitHub? – Satyam Raj Aug 20 '23 at 06:40

3 Answers3

23

I extended the solution of setting a new pattern of TODO by adding a MACRO to making the process automatic.

animation: replacing TODO with COMPLETED

  1. At first we have to have set a new pattern for TODO as I mentioned at the beginning.
  2. Then we have to make a macro by executing the following steps:

    • Go to: EDIT -> MACROS -> Start Macro Recording
    • Since now your actions are recording by Android Studio. Set the cursor on the “TODO” word and press: Left Alt + J // FOR MAC OS X: Ctrl + G / Shift + Ctrl + G (TODO word will be highlighted) See the screenshot #1
    • Now press the CAPS LOCK key button to turn on CAPS LOCK (or use SHIFT button instead of CAPS LOCK for typing capital letters)
    • …and type COMPLETED (or other word which you used in your own TODO pattern) See the screenshot #2
    • Now press the CAPS LOCK key button again to turn off CAPS LOCK (or release the SHIFT button)
    • Go to: EDIT -> MACROS -> Stop Macro Recording
    • Enter a name for your macro See the screenshot #3
  3. Go to: FILE -> SETTINGS -> KEYMAP (If you can’t find it, use the search field) See the screenshot #4

  4. Add your own Keyboard Shortcut See the screenshot #5

  5. Click APPLY

  6. THAT’S ALL! Set the cursor on TODO word in your code and press your preselected shortcut.

  • 1
    Half of the gif is attempting to prove you didn't touch the clipboard, but it did not prove that. I believe you though. :) – WSBT Jan 26 '18 at 05:17
22

The common convention is that when a TODO is done, then you delete it from the code.

Same with FIXME or STOPSHIP. (STOPSHIP might get picked up by CI servers and sets the build to failed until the comment is removed).

If you want to track progress of completed items, you have other tools available:

  • Use a ticket system like Redmine
  • Use a version control system like GIT and submit one commit per fix
  • Use a naming scheme (We use // <shortname>/<date>: Fixes #<number of bug)
Sebastian Roth
  • 11,344
  • 14
  • 61
  • 110
16

in the -> settings/editor/todo and follow the steps. Write the name you'll use to replace "TODO" as the name of the new pattern for step 1.

new todo patterns

Xvx
  • 67
  • 1
  • 11