Extracting method calls from fluent invocation

Hi,

given a statement like:

Wireup.Initialize().UsingSerialization().With("xxx").Build();

When I select the calls UsingSerialization and With, I want to transform it like:

Wireup.Initialize().With(Method).Build();

void Method(Wireup w) { w.UsingSerialization().With("xxx"); }

I started with:


      var solution = context.GetData (DataConstants.SOLUTION);

      var textControl = context.GetData (JetBrains.TextControl.DataContext.DataConstants.TEXT_CONTROL);

      var invocations = TextControlToPsi.GetElements<IInvocationExpression> (solution, textControl);

But it seems that this is a complete reference to Wireup......Build();

Would appreciate any help.

Please sign in to leave a comment.