For the reference provider to work, you need to override the getReferences() method on the PsiElement. This is mentioned in the header comment of com.intellij.psi.PsiReferenceProvider
public PsiReference getReferences()
Works for me without any changes.
Do I create a new class that derives from PsiElement and then override the getReferences() method? Do I then to register this somewhere?