fix formatting of lambda expressions

This commit is contained in:
Dmitry Jemerov
2011-08-26 18:56:43 +02:00
parent c5142c94b0
commit d6399075ac
4 changed files with 8 additions and 2 deletions
@@ -352,7 +352,7 @@ public class PyBlock implements ASTBlock {
if (type2 == PyElementTypes.STATEMENT_LIST) {
return Spacing.createSpacing(1, Integer.MAX_VALUE, 0, true, 0);
}
if (parentType == PyElementTypes.KEY_VALUE_EXPRESSION) {
if (parentType == PyElementTypes.KEY_VALUE_EXPRESSION || parentType == PyElementTypes.LAMBDA_EXPRESSION) {
return getSpacingForOption(getPySettings().SPACE_AFTER_PY_COLON);
}
}
@@ -387,7 +387,7 @@ public class PyBlock implements ASTBlock {
if (type2 == PyElementTypes.ARGUMENT_LIST) {
return getSpacingForOption(mySettings.SPACE_BEFORE_METHOD_CALL_PARENTHESES);
}
if (type2 == PyElementTypes.PARAMETER_LIST) {
if (type2 == PyElementTypes.PARAMETER_LIST && type1 != PyTokenTypes.LAMBDA_KEYWORD) {
return getSpacingForOption(mySettings.SPACE_BEFORE_METHOD_PARENTHESES);
}
+1
View File
@@ -0,0 +1 @@
lambda o:o.fullName()
@@ -0,0 +1 @@
lambda o: o.fullName()
@@ -135,6 +135,10 @@ public class PyFormatterTest extends PyLightFixtureTestCase {
CodeStyleSettingsManager.getInstance().getSettings(myFixture.getProject()).ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
doTest();
}
public void testLambdaColon() {
doTest();
}
public void testPsiFormatting() { // IDEA-69724
String initial =