use continuation indent in parameter list (PY-4356)

This commit is contained in:
Dmitry Jemerov
2011-11-16 09:45:52 +01:00
parent ee438d4255
commit 037d110a4c
3 changed files with 13 additions and 8 deletions
@@ -153,7 +153,9 @@ public class PyBlock implements ASTBlock {
childIndent = Indent.getNoneIndent();
}
else {
childIndent = Indent.getNormalIndent();
childIndent = parentType == PyElementTypes.PARAMETER_LIST
? Indent.getContinuationIndent()
: Indent.getNormalIndent();
}
}
else if (parentType == PyElementTypes.DICT_LITERAL_EXPRESSION || parentType == PyElementTypes.SET_LITERAL_EXPRESSION) {
@@ -483,6 +485,9 @@ public class PyBlock implements ASTBlock {
}
// constructs that imply indent for their children
if (_node.getElementType().equals(PyElementTypes.PARAMETER_LIST)) {
return Indent.getContinuationIndent();
}
if (ourListElementTypes.contains(_node.getElementType()) || _node.getPsi() instanceof PyStatementPart) {
return Indent.getNormalIndent();
}
@@ -1,3 +1,3 @@
def long_method_name(bar,
baz):
baz):
pass
@@ -156,10 +156,10 @@ public class PyFormatterTest extends PyTestCase {
String expected =
"def method_name(\n" +
" desired_impulse_response,\n" +
" desired_response_parameters,\n" +
" inverse_filter_length,\n" +
" observed_impulse_response):\n" +
" desired_impulse_response,\n" +
" desired_response_parameters,\n" +
" inverse_filter_length,\n" +
" observed_impulse_response):\n" +
"# Extract from here to ...\n" +
" desired_impulse_response = {'dirac, '\n" +
" gaussian\n" +
@@ -167,8 +167,8 @@ public class PyFormatterTest extends PyTestCase {
" return desired, o";
assertEquals(expected, reformatted.getText());
}
private void doTest() {
private void doTest() {
myFixture.configureByFile("formatter/" + getTestName(true) + ".py");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override