"space within method declaration parentheses" code style option (PY-8818)

This commit is contained in:
Dmitry Jemerov
2013-03-01 15:58:01 +01:00
parent fc8a8bdedb
commit 30110c2371
5 changed files with 11 additions and 0 deletions
@@ -46,6 +46,7 @@ public class PyLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettin
"SPACE_AROUND_MULTIPLICATIVE_OPERATORS",
"SPACE_AROUND_SHIFT_OPERATORS",
"SPACE_WITHIN_METHOD_CALL_PARENTHESES",
"SPACE_WITHIN_METHOD_PARENTHESES",
"SPACE_WITHIN_BRACKETS",
"SPACE_AFTER_COMMA",
"SPACE_BEFORE_COMMA",
@@ -96,6 +96,7 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
.around(DOT).spaces(0)
.before(SEMICOLON).spaceIf(commonSettings.SPACE_BEFORE_SEMICOLON)
.withinPairInside(LPAR, RPAR, ARGUMENT_LIST).spaceIf(commonSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES)
.withinPairInside(LPAR, RPAR, PARAMETER_LIST).spaceIf(commonSettings.SPACE_WITHIN_METHOD_PARENTHESES)
.before(LBRACKET).spaceIf(pySettings.SPACE_BEFORE_LBRACKET)
.withinPair(LBRACE, RBRACE).spaceIf(pySettings.SPACE_WITHIN_BRACES)
@@ -0,0 +1,2 @@
def foo(x, y):
pass
@@ -0,0 +1,2 @@
def foo( x, y ):
pass
@@ -317,6 +317,11 @@ public class PyFormatterTest extends PyTestCase {
doTest();
}
public void testSpaceWithinDeclarationParentheses() { // PY-8818
settings().SPACE_WITHIN_METHOD_PARENTHESES = true;
doTest();
}
private void doTest() {
myFixture.configureByFile("formatter/" + getTestName(true) + ".py");
ApplicationManager.getApplication().runWriteAction(new Runnable() {