References in Python string literals

I register reference provider through PsiReferenceContributor:

    public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
        PsiElementPattern.Capture<PsiElement> pattern = PlatformPatterns.psiElement().withParent(PyStringLiteralExpression.class);
        registrar.registerReferenceProvider(pattern, new ViewMethodReferenceProvider());

this method is called but the provider method isn't called.

Can I inject references to python string literals now?

Why do I need reference contributor (instead of registering PsiReferenceProvider directly)? Are there distinctions between these registration methods?


Please sign in to leave a comment.