use of com.jetbrains.python.psi.PyStatementListContainer in project intellij-community by JetBrains.
the class PyPlainEnterProcessor method getStatementList.
@Nullable
private static PyStatementList getStatementList(PsiElement psiElement, Editor editor) {
if (psiElement instanceof PyStatementListContainer) {
return ((PyStatementListContainer) psiElement).getStatementList();
} else {
final CaretModel caretModel = editor.getCaretModel();
final PsiElement atCaret = psiElement.getContainingFile().findElementAt(caretModel.getOffset());
final PyStatementPart statementPart = PsiTreeUtil.getParentOfType(atCaret, PyStatementPart.class);
if (statementPart != null) {
return statementPart.getStatementList();
}
}
return null;
}
Aggregations