PsiReference and navigation to function/static method

I write a plugin which by Ctrl+Click on string literal should resolve it as a function or static method and should navigate to file and it's declaration within this file.

I implemented PsiReference which correctly resolves the file and navigate to it, but what should I do to navigate to function/method declaration in the file?

Thank you in advance for your help!

0
Avatar
Permanently deleted user

The PsiFile is a PsiElement tree.  Walk it to find the class, and then walk the class to find the method.  There are a lot of PsiUtil/Core/Base functions to help walk the tree. 

You should turn on the PSI Viewer and look at the PSI tree to see how your language's tree is created. (Do so by adding `-Didea.is.internal=true` to your command line, or adding `idea.is.internal=true` to your idea.properties file.  Once you have, use the "Tools->View PSI Structure" menu item to see the tree.)

0

请先登录再写评论。