diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/ArbitraryPlaceUrlReferenceContributor.java b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/CommentsReferenceContributor.java similarity index 59% rename from platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/ArbitraryPlaceUrlReferenceContributor.java rename to platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/CommentsReferenceContributor.java index cf036f80d0da..06c3a22d3e7d 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/ArbitraryPlaceUrlReferenceContributor.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/CommentsReferenceContributor.java @@ -19,11 +19,21 @@ import com.intellij.patterns.PlatformPatterns; import com.intellij.psi.PsiComment; import com.intellij.psi.PsiReferenceContributor; import com.intellij.psi.PsiReferenceRegistrar; +import com.intellij.psi.ReferenceProviderType; import org.jetbrains.annotations.NotNull; -public class ArbitraryPlaceUrlReferenceContributor extends PsiReferenceContributor { +public class CommentsReferenceContributor extends PsiReferenceContributor { + /** + * Use this provider type if your element is not PsiComment but you want to fill it + * with the same references as PsiCommit (e.g. it's used for PsiDocToken). + * + * Also you can register your own reference provider as 'comment reference provider' and it will be + * applied to all PsiComment and other elements that uses this provider type for retrieving references. + */ + public static final ReferenceProviderType COMMENTS_REFERENCE_PROVIDER_TYPE = new ReferenceProviderType("commentsReferenceProvider"); + @Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { - registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiComment.class), ArbitraryPlaceUrlReferenceProvider.INSTANCE); + registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiComment.class), COMMENTS_REFERENCE_PROVIDER_TYPE.getProvider()); } } diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index a96bbb730bdb..d882f9231da4 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -767,7 +767,9 @@ - + +