mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
support "Spaces before method declaration parentheses" option for Python (PY-4241)
This commit is contained in:
@@ -381,6 +381,9 @@ public class PyBlock implements ASTBlock {
|
||||
if (type2 == PyElementTypes.ARGUMENT_LIST) {
|
||||
return getSpacingForOption(mySettings.SPACE_BEFORE_METHOD_CALL_PARENTHESES);
|
||||
}
|
||||
if (type2 == PyElementTypes.PARAMETER_LIST) {
|
||||
return getSpacingForOption(mySettings.SPACE_BEFORE_METHOD_PARENTHESES);
|
||||
}
|
||||
|
||||
if (type1 == PyTokenTypes.EQ || type2 == PyTokenTypes.EQ) {
|
||||
if (parentType == PyElementTypes.ASSIGNMENT_STATEMENT) {
|
||||
|
||||
@@ -33,6 +33,7 @@ public class PyLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettin
|
||||
public void customizeSettings(@NotNull CodeStyleSettingsCustomizable consumer, @NotNull SettingsType settingsType) {
|
||||
if (settingsType == SettingsType.SPACING_SETTINGS) {
|
||||
consumer.showStandardOptions("SPACE_BEFORE_METHOD_CALL_PARENTHESES",
|
||||
"SPACE_BEFORE_METHOD_PARENTHESES",
|
||||
"SPACE_AROUND_ASSIGNMENT_OPERATORS",
|
||||
"SPACE_AROUND_EQUALITY_OPERATORS",
|
||||
"SPACE_AROUND_RELATIONAL_OPERATORS",
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
def foo(bar, baz):
|
||||
pass
|
||||
|
||||
foo(True, False)
|
||||
@@ -0,0 +1,4 @@
|
||||
def foo (bar, baz):
|
||||
pass
|
||||
|
||||
foo(True, False)
|
||||
@@ -117,6 +117,11 @@ public class PyFormatterTest extends PyLightFixtureTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSpaceInMethodDeclaration() { // PY-4241
|
||||
CodeStyleSettingsManager.getInstance().getSettings(myFixture.getProject()).SPACE_BEFORE_METHOD_PARENTHESES = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPsiFormatting() { // IDEA-69724
|
||||
String initial =
|
||||
"def method_name(\n" +
|
||||
|
||||
Reference in New Issue
Block a user