If I have a semantic symbol lets say a parameter coming in to a method, Can I some how go back to the syntax node of this symbol?
In the below code lets say I have a handle on the "param" Identifier in the syntax tree from the param = "TEST"
, I swap over to the semantic model to determine the OriginalDefinition of param which takes me to the string param
in the method declaration. I now want to swap back to the syntax tree and goto the original definition node.
I was able to do this with what I would consider a hack var token = tree.Root.FindToken(origNode.Locations[0].SourceSpan.Start).Parent;
Is there a better way to do this? Perhaps something similar to the GetSemanticInfo()
but for the Syntax tree?
private void DoSomething(string param)
{
param = "TEST";
}
There isn't anything better in the current CTP, but this is feedback that we have heard, and we have a plan to address it in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With