Object[] (final String text, ProcessingContext context) { final Set<String> members = new HashSet<>(); myElement.getContainingFile().accept(new PyRecursiveElementVisitor() { @Override public void visitPyReferenceExpression(@NotNull PyReferenceExpression node) { super.visitPyReferenceExpression(node); visitPyQualifiedExpression(node); } @Override public void visitPyTargetExpression(@NotNull PyTargetExpression node) { super.visitPyTargetExpression(node); visitPyQualifiedExpression(node); } private void visitPyQualifiedExpression(PyQualifiedExpression node) { if (node != myElement) { final PyExpression qualifier = node.getQualifier(); if (qualifier != null && qualifier.getText().equals(text)) { final String refName = node.getReferencedName(); if (refName != null) { members.add(refName); } } } } }); List<LookupElement> results = new ArrayList<>(members.size()); final Set<String> namesAlready = visitedNames(context); for (String member : members) { results.add(AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(LookupElementBuilder.create(member))); namesAlready.add(member); } return ArrayUtil.toObjectArray(results); }