Customizing TODO filters
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.
Brian Schaad says:
February 27, 2007Is there a way to share todo tags with the team?
Ted says:
October 1, 2015Shareable 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
Gabriel Falkenberg says:
November 28, 2007Is there a way to have multi-line todo-items?
Uzbekjon says:
December 4, 2009I 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 …
Larry says:
April 14, 2010Will removing todo comments eventually make the files go off the list? :-/
Grr…
flex-developer says:
September 21, 2010I have flex and php code in my project. TODO works only for .php files(not for .mxml files).
Anton says:
November 26, 2010what about multiline TODO?
Victor says:
March 25, 2011Will very appreciate if somebody answers question about multi-line TODOs.
Tom says:
August 1, 2014I 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.*
yole says:
March 26, 2011Right now there is no support for multiline TODOs. See http://youtrack.jetbrains.net/issue/IDEA-62161 for more information.
abercrombie says:
January 24, 2012Is the TODO works only for php file?
hubert says:
February 29, 2012is there a way to automatically generate and assign a unique number to a todo ?
Chris says:
May 9, 2012I’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.
Yaroslav says:
November 25, 2014\battr\b.*(\n.*)*[^###]