Customizing TODO filters

Posted on by alexandra.rusina

Note   Contributed by: Esko Luontola

Probably, you already know about IntelliJ IDEA TODO window that finds your “TODO” comments and helps you quickly navigate to them. But did you know that you can work not only with TODO comments, but with any custom pattern?
For example, when you create a quick fix for a problem and don’t have the time to create a proper solution, you write a “hack” and leave a comment. You can start the comment from “Hack” and then explain why this code is bad and what should be done to fix it. Of course, it would be useful to find these comments later and navigate to them like you can do with TODO.
To add a new comments pattern, you need to press “Filter TODO Items” icon in the TODO tool window, and then select Edit Filters.

This will open the TODO dialog, where you can add, delete and modify your patterns. You can also apply filters that will display only certain patterns in the TODO window (to switch between filters, use the same “Filter TODO Items” icon).

When you add a new pattern, you can also specify the text color (it will appear in both the editor and TODO tool window) and the icon that can be used to show the priority.

After that, you can find your “hack” comments in the TODO window.

Technorati tags: , ,
Comments below can no longer be edited.

14 Responses to Customizing TODO filters

  1. Brian Schaad says:

    February 27, 2007

    Is there a way to share todo tags with the team?

    • Ted says:

      October 1, 2015

      Shareable todo patterns and filters would be really cool. In a scenario where you are multiple people working on the same user story you could share the patterns for keeping track of the todos/fixmes

  2. Gabriel Falkenberg says:

    November 28, 2007

    Is there a way to have multi-line todo-items?

  3. Uzbekjon says:

    December 4, 2009

    I would also love to know if there is a way to have multi-line TODO’s !

    I have very long todo’s with explanation of what should be done, but IDEA is turning only the first line into blue …

    Woudl really apreciate any directions …

  4. Larry says:

    April 14, 2010

    Will removing todo comments eventually make the files go off the list? :-/

    Grr…

  5. flex-developer says:

    September 21, 2010

    I have flex and php code in my project. TODO works only for .php files(not for .mxml files).

  6. Anton says:

    November 26, 2010

    what about multiline TODO?

  7. Victor says:

    March 25, 2011

    Will very appreciate if somebody answers question about multi-line TODOs.

    • Tom says:

      August 1, 2014

      I think I found a roundabout way to do Multi-Line TODOs with the filters.

      1 – Edit Filters in the TODO panel.
      2 – Add a new pattern that looks like this:

      \btodo\b.*\\\n.*-t.*

      You can replace the ‘-t’ part with anything really, just something that marks its another line in the same TODO.

      The only problem here is this has to be repeated…

      So the above pattern just lets you do a 2 line TODO, but if you want more than one, you have to keep adding to the pattern with this:

      \\\n.*-t.*

  8. yole says:

    March 26, 2011

    Right now there is no support for multiline TODOs. See http://youtrack.jetbrains.net/issue/IDEA-62161 for more information.

  9. abercrombie says:

    January 24, 2012

    Is the TODO works only for php file?

  10. hubert says:

    February 29, 2012

    is there a way to automatically generate and assign a unique number to a todo ?

  11. Chris says:

    May 9, 2012

    I’d like the TODO window to show only TODOs that I’ve added (maybe based on VCS/local history diffing). As is, I can switch to ‘Default Changelist’ in the TODO window but that shows *all* TODOs in files I’ve edited not just ‘my’ TODOs.

  12. Yaroslav says:

    November 25, 2014

    \battr\b.*(\n.*)*[^###]

Subscribe

Subscribe for updates