Accessing previous\next invocation expression from current invocation expression
When an element problem analyzer is called for a method invocation is it possible to get access to previous or next IInvocationExpression instance?
So if I have the following code:
var tmp = Observable.Return("Ollie")
.Select(n => "Ollie Riches")
.Reverse();
And I have an invocation expression analyzer:
public sealed class SelectAndReverseAnalyzer : ElementProblemAnalyzer<IInvocationExpression> {
protected override void Run(IInvocationExpression expression, ElementProblemAnalyzerData data, IHighlightingConsumer consumer)
{
...
}
}
When the Run overload is called for the Reverse' method how can I get the invocation expression for the 'Select' method?
ta
Ollie
Please sign in to leave a comment.
I don't think there's a prescribed way of doing it, but you can always walk the tree, using the sibling and parent properties of the IInvocationExpression. If you want more control of this process, you might want to implement an IDaemonStageProcess, which allows you to take full control of walking the PSI tree of the file: http://confluence.jetbrains.com/display/ReSharper/2.4+Daemons+and+Daemon+Stages+%28R7%29
I was able to get all of the expressions during an instance of ElementProblemAnalyzer<T> using the following code:
ta
Ollie
Matt - thought you would say that :)
I recon when I ahve it working end-to-end then I'll move it over to a daemon process.
thanks for the info
Ollie