public abstract class PsiReferenceContributor extends java.lang.Object implements Disposable
PsiReference
) to
PSI elements which support that. Such known elements include: XML tags and attribute values, Java/Python/Javascript
literal expressions, comments etc. The reference contributors are run once per project and are able to
register reference providers for specific locations. See PsiReferenceRegistrar
for more details.
The contributed references may then be obtained via
PsiReferenceService.getReferences(PsiElement, com.intellij.psi.PsiReferenceService.Hints)
,
which is the preferred way.
Some elements return them from PsiElement.getReferences()
directly though, but one should not rely on that
behavior since it may be changed in the future.
Note that, if you're implementing a custom language, it won't by default support references registered through PsiReferenceContributor.
If you want to support that, you need to call
ReferenceProvidersRegistry.getReferencesFromProviders(PsiElement)
from your implementation
of PsiElement.getReferences().
The alternative way to register PsiReferenceProvider
is by using PsiReferenceProviderBean
.PsiReferenceProviderBean
Disposable.Parent
Modifier and Type | Field and Description |
---|---|
static ExtensionPointName<KeyedLazyInstance<PsiReferenceContributor>> |
EP_NAME |
Constructor and Description |
---|
PsiReferenceContributor() |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Usually not invoked directly, see class javadoc.
|
abstract void |
registerReferenceProviders(PsiReferenceRegistrar registrar) |
public static final ExtensionPointName<KeyedLazyInstance<PsiReferenceContributor>> EP_NAME
public abstract void registerReferenceProviders(PsiReferenceRegistrar registrar)
public void dispose()
Disposable
dispose
in interface Disposable