Get all usages of a class/struct

I'm trying to create navigate to visitor navigation plugin (Visitor pattern). The idea is you stand on a usage of a struct or a class type or constructor, you press ctr+shift+g to bring up the navigate to context menu. Here I check if you stand on a class or a struct, then if you press Goto visitor I will get all usages of the type, check if the usage is a interface with a generic argument that is the navigate type and if the interface has a method that takes the generic type and nothing more. And if that is the case navigate to that method.


I have found the declared type by getting IReferenceName on the selected node and then do IReferenceName.Reference.Resolve to resolve the declared type (Is this the correct way?). But I'm a bit stuck on the next step to get all usages etc. The docs are very sparse. 


Can you guys please direct me in the correct direction? Thanks

1 comment
Comment actions Permalink

Any ideas? I have been able to get the declared type like 


var referenceName = dataContext.GetSelectedTreeNode<IReferenceName>();
var declaration = referenceName?.Reference.Resolve()?.DeclaredElement as ITypeElement;
if (declaration != null)


But now I need to find all methods taking this type as single argument. 


Please sign in to leave a comment.