Getting a PsiReference from a PyFunction

Hi,

I develop a Robot Framework plugin for Idea.

I am now adding support for "Jump to definition" for Keywords defined in imported Python files.

In the implementation of the PsiReferenceProvider.getReferencesByElement, I am currently able to find the relative PyFunction, but I cannot get any reference from it.

I have tried many methods:

function.getReference()
function.getReferences()
PsiReferenceService.getService.getReferences(function, Hints.NO_HINTS)


but all of them return null or an empty collection.
The functions/methods are found with calls to the Python indices (e.g. PyClassNameIndex.findClass(qName, currentPsiElem.getProject))

What am I doing wrong?

Valerio

2 comments
Comment actions Permalink

I guess that in this case I should just create a new PsiReference... In fact a Robot Framework Keyword is a reference to a Python function in a way...

0
Comment actions Permalink

What kind of reference are you expecting to get? PyFunction is a declaration, it does not refer to any other elements.

0

Please sign in to leave a comment.