use of com.jetbrains.python.psi.impl.references.PyReferenceImpl in project intellij-community by JetBrains.
the class PyReferenceExpressionImpl method getReference.
@NotNull
@Override
public PsiPolyVariantReference getReference(@NotNull PyResolveContext context) {
// Handle import reference
final PsiElement importParent = PsiTreeUtil.getParentOfType(this, PyImportElement.class, PyFromImportStatement.class);
if (importParent != null) {
return PyImportReference.forElement(this, importParent, context);
}
final PyExpression qualifier = getQualifier();
// Return special reference
final ConsoleCommunication communication = getContainingFile().getCopyableUserData(PydevConsoleRunner.CONSOLE_KEY);
if (communication != null) {
final String prefix = qualifier == null ? "" : qualifier.getText() + ".";
return new PydevConsoleReference(this, communication, prefix, context.allowRemote());
}
if (qualifier != null) {
return new PyQualifiedReference(this, context);
}
return new PyReferenceImpl(this, context);
}
Aggregations