Alignment () { // TODO merge it with needListAlignment(ASTNode) final IElementType nodeType = myNode.getElementType(); if (ourListElementTypes.contains(nodeType) || nodeType == PyElementTypes.SLICE_ITEM || nodeType == PyElementTypes.STRING_LITERAL_EXPRESSION) { if (isInControlStatement()) { return null; } final PsiElement elem = myNode.getPsi(); if (elem instanceof PyParameterList && !myContext.getSettings().ALIGN_MULTILINE_PARAMETERS) { return null; } if ((elem instanceof PySequenceExpression || elem instanceof PyComprehensionElement) && !myContext.getPySettings().ALIGN_COLLECTIONS_AND_COMPREHENSIONS) { return null; } if (elem instanceof PyParenthesizedExpression) { final PyExpression parenthesized = ((PyParenthesizedExpression)elem).getContainedExpression(); if (parenthesized instanceof PyTupleExpression && !myContext.getPySettings().ALIGN_COLLECTIONS_AND_COMPREHENSIONS) { return null; } } if (elem instanceof PyDictLiteralExpression) { final PyKeyValueExpression lastElement = ArrayUtil.getLastElement(((PyDictLiteralExpression)elem).getElements()); if (lastElement == null || lastElement.getValue() == null /* incomplete */) { return null; } } if (elem instanceof PyWithStatement && PyPsiUtils.getFirstChildOfType(elem, PyTokenTypes.LPAR) == null) { return null; } return getAlignmentForChildren(); } return null; }