Search in sources :

Example 1 with PerlReferencesProvider

use of com.perl5.lang.perl.extensions.parser.PerlReferencesProvider in project Perl5-IDEA by Camelcade.

the class PerlStringContentElementImpl method computeReferences.

@Override
public PsiReference[] computeReferences() {
    List<PsiReference> result = new ArrayList<>();
    if (looksLikePackage()) {
        result.add(new PerlNamespaceReference(PerlStringContentElementImpl.this));
    } else {
        @SuppressWarnings("unchecked") PerlReferencesProvider referencesProvider = PsiTreeUtil.getParentOfType(PerlStringContentElementImpl.this, PerlReferencesProvider.class, true, PsiPerlStatement.class);
        if (referencesProvider != null) {
            PsiReference[] references = referencesProvider.getReferences(PerlStringContentElementImpl.this);
            if (references != null) {
                result.addAll(Arrays.asList(references));
            }
        }
    }
    result.addAll(Arrays.asList(ReferenceProvidersRegistry.getReferencesFromProviders(PerlStringContentElementImpl.this)));
    return result.toArray(new PsiReference[result.size()]);
}
Also used : PerlNamespaceReference(com.perl5.lang.perl.psi.references.PerlNamespaceReference) ArrayList(java.util.ArrayList) PsiReference(com.intellij.psi.PsiReference) PerlReferencesProvider(com.perl5.lang.perl.extensions.parser.PerlReferencesProvider)

Aggregations

PsiReference (com.intellij.psi.PsiReference)1 PerlReferencesProvider (com.perl5.lang.perl.extensions.parser.PerlReferencesProvider)1 PerlNamespaceReference (com.perl5.lang.perl.psi.references.PerlNamespaceReference)1 ArrayList (java.util.ArrayList)1