java – Is there a way to mark TODO complete in Android studio?-ThrowExceptions

Exception or error:

I’m trying to track TODOs in Android studio.

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

How to solve:

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)

###

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.

###

in the -> settings/editor/todo and follow the steps

new todo patterns

Leave a Reply

Your email address will not be published. Required fields are marked *