In Resharper 7.1.1000.900 in VS2010, I've created a pattern to search and replace, and it's not finding any instances. It's intended to take a ternary expression like this:
var x = booleanExpression? Foo(a, b, c, 1, d, e, f) : (Foo(a, b, c, 2, d, e, f);
and transform it to:
var variant = booleanExpression? 1 : 2;
Foo(a, b, c, variant, d, e, f);
which is less verbose and easier to read.
Here's the search pattern:
$id$ = $bool$? $foo$($preArgs$, $variantArg1$, $postArgs$) : $foo$($preArgs$, $variantArg2$, $postArgs$);
Here's the replace pattern:
var variant = $bool$? $variantArg1$ : $variantArg2$;
$id$ = $foo$($preArgs$, variant, $postArgs$);
Here are the placeholder definitions:
|bool||expression which is of type System.Boolean or one of its derived types|
|postArgs||any number of arguments|
|preArgs||any number of arguments|
|variantArg1||exactly one argument|
|variangArg2||exactly one argument|
I've also checked "Match similar constructs", "Format after replace", and "Shorten References".
Thank you for the report. We've checked that out, and it appears to be a bug in R# SSR subsystem. I've logged this issue for further fixing here: http://youtrack.jetbrains.com/issue/RSRP-338199.
We apologize for the inconvenience.