mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
prototype of completion for qualified references
This commit is contained in:
@@ -95,6 +95,11 @@ public class PyClassImpl extends PyPresentableElementImpl<PyClassStub> implement
|
||||
final PyStatementList statementList = getStatementList();
|
||||
for (PsiElement element : statementList.getChildren()) {
|
||||
if (element instanceof PyFunction) {
|
||||
final PyFunction function = (PyFunction)element;
|
||||
final String name = function.getName();
|
||||
if (processor instanceof PyResolveUtil.VariantsProcessor && name != null && name.startsWith("__") && name.endsWith("__")) {
|
||||
continue;
|
||||
}
|
||||
if (!processor.execute(element, substitutor)) return false;
|
||||
}
|
||||
}
|
||||
@@ -109,6 +114,9 @@ public class PyClassImpl extends PyPresentableElementImpl<PyClassStub> implement
|
||||
}
|
||||
}
|
||||
}
|
||||
if (processor instanceof PyResolveUtil.VariantsProcessor) {
|
||||
return true;
|
||||
}
|
||||
return processor.execute(this, substitutor);
|
||||
}
|
||||
|
||||
|
||||
@@ -161,8 +161,22 @@ public class PyReferenceExpressionImpl extends PyElementImpl implements PyRefere
|
||||
}
|
||||
|
||||
public Object[] getVariants() {
|
||||
if (getQualifier() != null) {
|
||||
return new Object[0]; // TODO?
|
||||
final PyExpression qualifier = getQualifier();
|
||||
if (qualifier != null) {
|
||||
PyType qualifierType = qualifier.getType();
|
||||
PsiElement variantsOwner = null;
|
||||
if (qualifierType instanceof PyClassType) {
|
||||
variantsOwner = ((PyClassType) qualifierType).getPyClass();
|
||||
}
|
||||
else if (qualifierType instanceof PyModuleType) {
|
||||
variantsOwner = ((PyModuleType) qualifierType).getModule();
|
||||
}
|
||||
if (variantsOwner != null) {
|
||||
final PyResolveUtil.VariantsProcessor processor = new PyResolveUtil.VariantsProcessor();
|
||||
variantsOwner.processDeclarations(processor, ResolveState.initial(), null, this);
|
||||
return processor.getResult();
|
||||
}
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
final PyResolveUtil.VariantsProcessor processor = new PyResolveUtil.VariantsProcessor();
|
||||
|
||||
Reference in New Issue
Block a user