Aaarg!! Structural Search

Build 7027: I want to find all declarations of type int.
There's no predefined structural search template for declarations, so I started with "unboxing in declarations" which looks like "$Type$ $Var$ = $Value$".
I removed the " = $Value$" part and Idea happily found a lot of declarations, including those of type "int".

Then I changed the "int|boolean|long|char|short|byte" text constraint on the "$Type$" variable to "int".
=> Idea no longer finds anything at all. It immediately says "No occurences found ..."

Is this a bug or am I missing some obscure checkbox in this non-intuitive interface?

BTW: Votes for the "Structural Search & Replace Wizard" are welcome:
http://www.jetbrains.net/jira/browse/IDEABKL-5158

3 comments

I just experimented with this, and found that unless you have an OR token '|' in the text constraint, the main search dialog status line (at the bottom) will display:

"This pattern is malformed It does not match anything in selected scope"

On my search dialog (also build 7027), the 'Find' button is disabled when this happens. If you add a '|' to the text constraint, e.g. "|int" or "int|", the message goes away, the button is enabled, and it will find the int declarations.

I don't know how you managed to get it to search at all without the '|'...

If I hadn't started, as you did, by copying a template that contained "int|boolean|long|char|short|byte" as its text constraint, I would never have guessed that the '|' is required to enable the search even for a single constraint element.

null

0

Hm, "int" is valid for me (and shown in dark blue in the constraint text field probably because it is recognized as a type). I only get the "malformed" message if I enter a dummy text like "foo".

You're right, though: Using "int|" is doing what I want.

This SSR feature is a strange beast indeed...

0

This is bug, please, file JIRA ticket

Stephen Friedrich wrote:

Build 7027: I want to find all declarations of type int.
There's no predefined structural search template for declarations, so I started with "unboxing in declarations" which looks like "$Type$ $Var$ = $Value$".
I removed the " = $Value$" part and Idea happily found a lot of declarations, including those of type "int".

Then I changed the "int|boolean|long|char|short|byte" text constraint on the "$Type$" variable to "int".
=> Idea no longer finds anything at all. It immediately says "No occurences found ..."

Is this a bug or am I missing some obscure checkbox in this non-intuitive interface?

BTW: Votes for the "Structural Search & Replace Wizard" are welcome:
http://www.jetbrains.net/jira/browse/IDEABKL-5158



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.