mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Get rid of grandparent for alignment.
This commit is contained in:
@@ -142,23 +142,30 @@ public class PyBlock implements ASTBlock {
|
||||
Indent childIndent = Indent.getNoneIndent();
|
||||
Alignment childAlignment = null;
|
||||
|
||||
//First we are going to set-up possible alignment to parents
|
||||
PyBlock p = !breaksAlignment(parentType) ? myParent : null;
|
||||
while (p != null) {
|
||||
ASTNode pNode = p.getNode();
|
||||
if (ourListElementTypes.contains(pNode.getElementType())) {
|
||||
if (needListAlignment(child) && !isEmptyList(_node.getPsi()) && !isInControlStatement()) {
|
||||
if (parentType == PyElementTypes.BINARY_EXPRESSION && !isInControlStatement()) {
|
||||
//Setup alignments for binary expression
|
||||
childAlignment = getAlignmentForChildren();
|
||||
|
||||
PyBlock p = myParent; //Check grandparents
|
||||
while (p != null) {
|
||||
ASTNode pNode = p.getNode();
|
||||
if (ourListElementTypes.contains(pNode.getElementType())) {
|
||||
if (needListAlignment(child) && !isEmptyList(_node.getPsi())) {
|
||||
|
||||
childAlignment = p.getChildAlignment();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (pNode == PyElementTypes.BINARY_EXPRESSION) {
|
||||
childAlignment = p.getChildAlignment();
|
||||
}
|
||||
if (!breaksAlignment(pNode.getElementType())) {
|
||||
p = p.myParent;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!breaksAlignment(pNode.getElementType())) {
|
||||
p = p.myParent;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (childType == PyElementTypes.STATEMENT_LIST) {
|
||||
@@ -193,14 +200,6 @@ public class PyBlock implements ASTBlock {
|
||||
PyStatementPart.class);
|
||||
childIndent = parens != null ? Indent.getNormalIndent() : Indent.getContinuationIndent();
|
||||
}
|
||||
else {
|
||||
if (grandparentType == PyElementTypes.BINARY_EXPRESSION && myParent != null) {
|
||||
childAlignment = myParent.getAlignmentForChildren();
|
||||
}
|
||||
else {
|
||||
childAlignment = getAlignmentForChildren();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parentType == PyElementTypes.LIST_LITERAL_EXPRESSION || parentType == PyElementTypes.LIST_COMP_EXPRESSION) {
|
||||
|
||||
Reference in New Issue
Block a user