ReferenceContributor not work from custom langauge

Hi.

I’ve spent much time to understand how to do it in my own custom languages and why it didn’t work :grin:

Things that help me to inject references to my psi elements:

  1. add override fun getReferences(): Array<PsiReference> = ReferenceProvidersRegistry.getReferencesFromProviders(this) to the element should have references
  2. add { implements=["com.intellij.psi.NavigatablePsiElement"] } into the bnf to the according psi element pattern declaration

Do not forget to rebuild parser.
Also I’ve noticed that your snippet has error, there are no “implementation” attribute, so correct version will be: <psi.referenceContributor language="MyLanguage" implementation="xxxxx.MyReferenceContributor" />

3 Likes