RegExp use for TODO

Hi Guys,

I have been trying to define a new TODO pattern with no success. The pattern I am trying to use is:

\bTODO\.[1|2|3][ ].* (actual regexp is /\bTODO\.[1|2|3][ ].*/)

which should match

# TODO.3 When a component name is changed its dictionary is lost because its

in

# TODO.3 When a component name is changed its dictionary is lost because its
#   name is now changed.

I have checked this regexp in numerous regexp editors (including Rubular) and it works in them, but not in RubyMine. What am I missing? Is there a different regexp syntax I should be using other than Ruby, JavaScript and C++?

Joe.....

10 comments
Comment actions Permalink

Hi Joe,

The pattern is fine -- works for me in both PhpStorm v5.0.2 and RubyMine v4.5.3 on Windows 7 (sorry, I was too lazy to download latest 4.5.4 version)

When you say "It does not work" -- what do you mean exactly? Does it work at all ... or maybe it works but default style is used?

If 2nd then in my understanding the default pattern will also match such TODO, so if you have configured different colors for this specific pattern, you may still see it styled with "main" colors and not custom one that assigned to this pattern. If you check the TODO panel, you should see it listed there twice or more times (if multiple patterns matching).

See the screenshots:
screen02.png
screen01.png
P.S.
I'm not RubyMine user and not familiar with the language (at all).

0
Comment actions Permalink

Hi Andriy,

Thanks for the quick response. I recreated your approach adding a pattern instead of changing the default pattern and that worked. However, as you pointed out, I have two enties in the TODO window for each task; one for the default entry and one for my new pattern. If I delete the default pattern leaving only my pattern it does not work. See image. If this is the way it is supposed to work I am dissapointed, but I hope that is not what is intended and there is something I am doing wrong or perhaps a bug. If you have any further ideas I would appreciate it. Thanks again, Joe.....

10-12-2012 2-20-42 PM.jpg

0
Comment actions Permalink

I can confirm the same behaviour.

Unfortunately I have no clue why it does that. In PhpStorm it works if I delete the default pattern as well if I just make the default pattern case-sensitive. But this "trick" with case-sensitivity does not work in RubyMine.

I may only suggest checking the Issue Tracker for any existing bug report and submit new one if none found (check RUBY and IDEA projects, since this is a platform feature).

0
Comment actions Permalink

What I may also suggest -- is some workaround, which should work:

1. Re-create default pattern back (so you should have default and your one)
2. On the same settings page (Settings | TODO), look at the bottom part -- the "Filters" list.
3. Create one filter (name it "Workaround", for example) and assign only your pattern to it.
4. Now go to TODO panel, click on Filter/Funnel icon and select your custom filter -- now it will only show you todos that match your pattern only (in other words -- the same todo entry will only be listed once)

The downside -- you will not be able to see todos matching default pattern.

screen01.png
screen02.png

0
Comment actions Permalink

Thanks again Andriy for the quick and helpful response. I am going to do everything you suggest and see what I can find out. The interesting thing is that the default patter, if it is indeed a regex pattern, shouldn't match what it appears to match. I have tried it in several regex editors and it does not match my TODO tasks, yet it does in RUbyMine. Weird indeed. Thanks again, Joe....

0
Comment actions Permalink
The interesting thing is that the default patter, if it is indeed a regex pattern, shouldn't match what it appears to match. I have tried it in several regex editors and it does not match my TODO tasks, yet it does in RUbyMine. Weird indeed.

Matches for me:

screen01.png

0
Comment actions Permalink

Hmmmm, that works, but only when the Current File is chosen in the TODO window. If the Project tab is selected it doesn't work. Seems like there are a number of problems with the TODO filter. I'll search the Issues Tracking and othere sourcs and if necessary file a bug report. Thanks again, Joe......

0
Comment actions Permalink

I have restarted RubyMine .. and it is opposite for me now -- works in Project wide but does not in Current File tab...

Weird indeed...

0
Comment actions Permalink

See http://youtrack.jetbrains.com/issue/RUBY-8883 second post from the bottom. That workaround seems to work. I stick by my comment about the default pattern not being a legal pattern and the problem seems to be related to that and RDocLexer. I am going to add a comment to Ruby-8883 pointing to this thread too. Joe....

0
Comment actions Permalink

Interesting. I tried the "RDOC" fix in my notebook which has version 4.5 and the results are different still. The "RDOC" workaround doesn't work in 4.5 but does in 4.5.4. This bug seems to change with each release! Joe...

0

Please sign in to leave a comment.