Why doesn't the replace part of my pattern work?

This structured pattern...

  <Pattern Severity="SUGGESTION" FormatAfterReplace="True" ShortenReferences="True" Language="CSHARP">
    <Comment>Could be added to IEnumerable.Contains</Comment>
    <ReplaceComment>Add to the IEnumerable.Contains()</ReplaceComment>
    <ReplacePattern>new [] { $ARRAY$, $EXPR2$ }.Contains($VAR$)</ReplacePattern>
    <SearchPattern>new [] { $ARRAY$ }.Contains($VAR$) || $VAR$ == $EXPR2$</SearchPattern>
    <Params />
    <Placeholders>
      <ExpressionPlaceholder Name="EXPR2" ExpressionType="" ExactType="True" />
      <IdentifierPlaceholder Name="VAR" Type="" ExactType="False" RegEx="" CaseSensitive="True" />
      <ArgumentPlaceholder Name="ARRAY" Minimal="-1" Maximal="-1" />
    </Placeholders>
  </Pattern>



...matches the second line of this code...

var a = "slsls";
var b = new[] {"string2", "str1"}.Contains(a) || a == "kdkd";



... but when invoking the replacement pattern it silently fails.  Why?
1 comment

Hello,

This seems to be a bug, because replace works fine when $ARRAY$ matches a
single argument. I've logged it under http://youtrack.jetbrains.net/issue/RSRP-276447
and you're welcome to vote for it. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

This structured pattern...

 Severity="SUGGESTION" FormatAfterReplace="True"
> ShortenReferences="True" Language="CSHARP">
> Could be added to IEnumerable.Contains
> Add to the IEnumerable.Contains()
> new [] { $ARRAY$, $EXPR2$
> }.Contains($VAR$)
> new [] { $ARRAY$ }.Contains($VAR$) || $VAR$ ==
> $EXPR2$
> 
> 
>  ExactType="True" />
>  RegEx="" CaseSensitive="True" />
> 
> 
> ]]>

..matches the second line of this code...

 "str1"}.Contains(a) || a == "kdkd";]]>


.. but when invoking the replacement pattern it silently fails.  Why?

---
Original message URL:
http://devnet.jetbrains.net/message/5320584#5320584



0

Please sign in to leave a comment.