void (Editor editor, PsiElement occurrence) { PyQualifiedExpression qExpr = PsiTreeUtil.getParentOfType(occurrence, PyQualifiedExpression.class, false); if (qExpr != null && !qExpr.isQualified()) { qExpr = PsiTreeUtil.getParentOfType(qExpr, PyQualifiedExpression.class); } if (qExpr != null) { final ASTNode nameElement = qExpr.getNameElement(); if (nameElement != null) { final int offset = nameElement.getTextRange().getStartOffset(); editor.getCaretModel().moveToOffset(offset); } } }