mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use continuation indent in parameter list (PY-4356)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user