You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to extend my previous plugin (auto-completing certain text inside Yaml string values) and make it so that those are ctrl-clickable so that I can navigate to the matching yaml key value in whatever file they exist in.
Following some other examples I have written the code that SEEMS like it should work... however... every time I try to actually register the ReferenceContributor, I get this IDE error:
java.lang.Throwable: Reference provider registration is only allowed from PsiReferenceContributor
I have tried to do it a hundred ways, and always get this error. So it seems I'm not doing it correctly. And I AM running registrar.regidterReferenceProvider from inside a PsiReferenceContributor instance. So maybe it can only be registered internally upon plugin startup, defined in the gradle config?
Does LivePlugin have any functionality to attach/register a ReferenceContributor in the proper way? I'm at a loss, and spent the last 48 hours tearing my hair out trying to get an actual plugin to even remotely work.
The text was updated successfully, but these errors were encountered:
Sorry for the slow reply. I don't really know the answer and was trying to focus on a conference talk 🙈
Searching IJ code for "Reference provider registration is only allowed from PsiReferenceContributor" there is only one usage of it in com.intellij.psi.impl.source.resolve.reference.PsiReferenceRegistrarImpl#registerReferenceProvider() and it has this condition myInitialized && !ApplicationManager.getApplication().isUnitTestMode() && parentDisposable == null. It also looks like this is just logging the error but runs the code anyway.
There might be a good reasons it logs an error, so why not try using PsiReferenceContributor and register it via extension point com.intellij.psi.PsiReferenceContributor#EP_NAME? It's not guaranteed that it will work though because some IJ APIs are not designed to be very reloadable.
I am trying to extend my previous plugin (auto-completing certain text inside Yaml string values) and make it so that those are ctrl-clickable so that I can navigate to the matching yaml key value in whatever file they exist in.
Following some other examples I have written the code that SEEMS like it should work... however... every time I try to actually register the ReferenceContributor, I get this IDE error:
java.lang.Throwable: Reference provider registration is only allowed from PsiReferenceContributor
I have tried to do it a hundred ways, and always get this error. So it seems I'm not doing it correctly. And I AM running registrar.regidterReferenceProvider from inside a PsiReferenceContributor instance. So maybe it can only be registered internally upon plugin startup, defined in the gradle config?
Does LivePlugin have any functionality to attach/register a ReferenceContributor in the proper way? I'm at a loss, and spent the last 48 hours tearing my hair out trying to get an actual plugin to even remotely work.
The text was updated successfully, but these errors were encountered: