Make right par indent=none in import statement (PY-9075).

This commit is contained in:
Dmitry Trofimov
2014-01-18 02:29:07 +01:00
parent 0a33757064
commit 33c31e6384
4 changed files with 20 additions and 6 deletions
@@ -213,13 +213,17 @@ public class PyBlock implements ASTBlock {
}
}
else if (parentType == PyElementTypes.FROM_IMPORT_STATEMENT) {
if ((childType == PyElementTypes.IMPORT_ELEMENT || childType == PyTokenTypes.RPAR) &&
_node.findChildByType(PyTokenTypes.LPAR) != null) {
if (myContext.getPySettings().ALIGN_MULTILINE_IMPORTS) {
childAlignment = getAlignmentForChildren();
if (_node.findChildByType(PyTokenTypes.LPAR) != null) {
if (childType == PyElementTypes.IMPORT_ELEMENT) {
if (myContext.getPySettings().ALIGN_MULTILINE_IMPORTS) {
childAlignment = getAlignmentForChildren();
}
else {
childIndent = Indent.getNormalIndent();
}
}
else {
childIndent = Indent.getNormalIndent();
if (childType == PyTokenTypes.RPAR) {
childIndent = Indent.getNoneIndent();
}
}
}
@@ -0,0 +1,3 @@
from some.module import (
thing
)
@@ -0,0 +1,3 @@
from some.module import (
thing
)
@@ -366,6 +366,10 @@ public class PyFormatterTest extends PyTestCase {
doTest();
}
public void testIndentParensInImport() { // PY-9075
doTest();
}
private void doTest() {
doTest(false);
}