Reference contributor extension point is not being executed
Answered
Hi,
I am not sure if I'm going insane or something, but PsiReferenceContributor#registerReferenceProviders seems to never be called.
I have the implementation stubbed to throw an exception
override fun registerReferenceProviders(registrar: PsiReferenceRegistrar) {
TODO("Not implemented")
}
There is a relevant entry in the plugin.xml
<psi.referenceContributor
language="MyLang"
implementation="mylang.MyLangReferenceContributor"/>
I also have a file type, parser, syntax highlighter, folding builder, commenter registered. Those are all working as expected. I am running against IU 2022.1, java 11, gradle 7.4.
Let me know if any other information is helpful! Thanks in advance.
Please sign in to leave a comment.
Seems like exceptions might be silenced in this case? I have also tried the implementation from the tutorial series, printing a string when its called, setting a breakpoint there. It certainly does not appear to be getting called.
Hi,
Are you sure that you call the logic creating references for your language? Please take a look at PsiReferenceContributor's Javadoc and make sure elements in your language follow these rules, especially:
Your contributor won't be instantiated and providers won't be registered until PSI for your language file is built and one of its elements asks for contributed references. See also: ContributedReferenceHost.