void (@NotNull PsiReferenceRegistrar registrar) { final Configuration configuration = Configuration.getInstance(); registerUastReferenceProvider(registrar, injectionHostUExpression().annotationParam(StandardPatterns.string().with( new PatternCondition<>( "isLanguageAnnotation") { @Override public boolean accepts(@NotNull final String s, final ProcessingContext context) { return Objects.equals(configuration.getAdvancedConfiguration().getLanguageAnnotationClass(), s); } }), "value"), new UastInjectionHostReferenceProvider() { @Override public boolean acceptsTarget(@NotNull PsiElement target) { return false; } @Override public PsiReference @NotNull [] getReferencesForInjectionHost(@NotNull UExpression uExpression, @NotNull PsiLanguageInjectionHost host, @NotNull ProcessingContext context) { return new PsiReference[]{new ULiteralLanguageReference(uExpression, host)}; } }, PsiReferenceRegistrar.DEFAULT_PRIORITY); registrar.registerReferenceProvider(literalExpression().with(new PatternCondition<>("isStringLiteral") { @Override public boolean accepts(@NotNull final PsiLiteralExpression expression, final ProcessingContext context) { return PsiUtilEx.isStringOrCharacterLiteral(expression); } }), new PsiReferenceProvider() { @Override public boolean acceptsTarget(@NotNull PsiElement target) { return target instanceof PsiLiteral; } @Override public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext context) { final PsiLiteralExpression expression = (PsiLiteralExpression)psiElement; final PsiModifierListOwner owner = AnnotationUtilEx.getAnnotatedElementFor(expression, AnnotationUtilEx.LookupType.PREFER_DECLARATION); if (owner != null && PsiUtilEx.isLanguageAnnotationTarget(owner)) { final PsiAnnotation[] annotations = AnnotationUtilEx.getAnnotationFrom(owner, configuration.getAdvancedConfiguration().getPatternAnnotationPair(), true); if (annotations.length > 0) { final String pattern = AnnotationUtilEx.calcAnnotationValue(annotations, "value"); if (pattern != null) { return new PsiReference[]{new RegExpEnumReference(expression, pattern)}; } } } return PsiReference.EMPTY_ARRAY; } }); }