@Override
  public boolean isIncomplete() {
    // if there's something following us, we're not incomplete
    if (!PsiTreeUtil.hasErrorElements(myNode.getPsi())) {
      if (myNode.getPsi() instanceof PsiFile) {
        return false;
      }
      PsiElement element = myNode.getPsi().getNextSibling();
      while (element instanceof PsiWhiteSpace) {
        element = element.getNextSibling();
      }
      if (element != null) {
        return false;
      }
    }

    final ASTNode lastChild = getLastNonSpaceChild(myNode, false);
    if (lastChild != null) {
      if (lastChild.getElementType() == PyElementTypes.STATEMENT_LIST) {
        // only multiline statement lists are considered incomplete
        final ASTNode statementListPrev = lastChild.getTreePrev();
        if (statementListPrev != null && statementListPrev.getText().indexOf('\n') >= 0) {
          return true;
        }
      }
      if (lastChild.getElementType() == PyElementTypes.BINARY_EXPRESSION) {
        final PyAstBinaryExpression binaryExpression = (PyAstBinaryExpression)lastChild.getPsi();
        if (binaryExpression.getRightExpression() == null) {
          return true;
        }
      }
      if (isIncompleteCall(lastChild)) return true;
    }

    if (myNode.getPsi() instanceof PyAstArgumentList argumentList) {
      return argumentList.getClosingParen() == null;
    }
    if (isIncompleteCall(myNode) || isIncompleteExpressionWithBrackets(myNode.getPsi())) {
      return true;
    }

    return false;
  }
@Override
  public boolean isIncomplete()