Finding declarations of a variable


I'm pretty new to Intellij plugin development so please bear with me.

I'm writing a project specific plugin and I'm trying to figure out how to find a PsiElement using nothing but a variable name.  In my case, using PsiViewer, I see that I have a VariableDecl that has the FQN of the element I want to find, but I need to access that VariableDecl element through code.

If I could figure out how the goto declaration tool works that would also probably work (this variable is only assigned to once in it's life time).

The plugin is intended to run in PhpStorm, so I can't use the findClass or findMethod functions as I am looking for a specific global variable.

Thanks for your patience and help!

Please sign in to leave a comment.