Trouble with Search with Pattern

I'm using Resharper version 5.1.3.

Is it just me, or is anyone else having severe trouble getting this feature to work?  Perhaps I just don't understand, but I've been through the documentation and through numerous examples, and I just can't make it work.

Even the pattern catalog won't work properly.  For example:

This pattern, straight out of the catalog:

$expr$.GetType() == typeof($S$)

Running it against a giant IF statement that looks like this:

                        if (Command.GetType() == typeof(CommandTypeOne))
                            HandleCommandTypeOne();
                        else if (Command.GetType() == typeof(CommandTypeTwo))
                            HandleCommandTypeTwo();
                        ...

(italicised items changed for privacy)

yet it comes back with no matches.

Yes, I realize there are bigger issues with the above code, but I'm doing a massive refactoring to try to correct much of this, and Search with Pattern is the only way to fix numerous shutgun surgery smells throughout the codebase.


What am I doing wrong?

As an aside, one thing that would make this feature MUCH more powerful is if you could have an example of what you're trying to find in the GUI, a test case if you would, and have the expression editor tell you if you would match it or not and, if possible, which part doesn't match up correctly.

1 comment

My problem is often that I am not sure which parameter-type I have to use.

Importing the pattern cataloge and playing around with tehm often results in a visual studio crash and I also lost all of my patterns recently, very annoying.

0

Please sign in to leave a comment.