Help with patterns for To-Do Items
We use regions extensively in our project, and I have a habit of marking them as not finished when I've stubbed them in and am still working on them, like such:
#region Name of Region Here [NOT FINISHED]
int i;
#endregion
Before I started using ReSharper, I'd just do a find-all for "[NOT FINISHED]" to find where I still needed to work on things. However, I see that with ReSharper there is a To-Do list feature that can be generated with regex patterns. I've tried making a pattern to match "NOT FINISHED" so it would give me a nice list of all of these, but so far it isn't working. Right now I have as my pattern "(NOT FINISHED)" (sans quotes), and have checked the boxes for "In comments", "In strings", and "In identifiers" in attempt to make something show up for it. I have a feeling ReSharper isn't matching because the would-be match is in a #region directive. Once I took it out and put it in a comment on the next line down like this:
#region Name of Region Here
//[NOT FINISHED]
int i;
#endregion
ReSharper picked it up and put it into my list perfectly. I would like to keep my NOT FINISHED in with the name of the region, since then when the region gets collapsed I can still see that it is unfinished. Does anyone know of a way to get these patterns to match this way?
On somewhat of a side-note, when I inspected what the other patterns were using for regex, I came across what I'm not familiar with: the use of <TAG>, like in the Note regex: (?<=\W|^)(?<TAG>NOTE)(\W|$)(.*)
I understand the rest of the regex, except for the question mark immediately preceding <TAG>, as it seems to me that should be stating that the regex is looking for 0 or 1 of the parenthesis preceding it, yet that would seem to be invalid syntax and definetly NOT what it's actually doing. Could anyone help explain this for me?
Please sign in to leave a comment.
I have used this feature to spot generation errors I had inserted when using Codesmith , but I suspect the search is for a line starting // xxx
I used
// Codesmith Generation Error
That worked , maybe
//[NotFinished]
#region xxxx
may work
Mike
Hello Laura,
Regarding your questions:
1. At the moment ReSharper can search for todo items in comments, strings
and identifiers only, while #region RegionName is none of these. That's why
it doesn't count "#region ... " as todo items. You're welcome
to put a feature request through http://youtrack.jetbrains.net/issues/RSRP.
2. (?TODO)' group. So if you have a comment
"//TODO: implement this", it will be displayed as "TODO: implement
this" in To-do Explorer.
Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"