diff --git a/python/src/com/jetbrains/python/formatter/PyBlock.java b/python/src/com/jetbrains/python/formatter/PyBlock.java index f471765e298b..2a7343dda3ed 100644 --- a/python/src/com/jetbrains/python/formatter/PyBlock.java +++ b/python/src/com/jetbrains/python/formatter/PyBlock.java @@ -240,6 +240,11 @@ public class PyBlock implements ASTBlock { childIndent = Indent.getNormalIndent(); } } + else if (parentType == PyElementTypes.REFERENCE_EXPRESSION) { + if (child != _node.getFirstChildNode()) { + childIndent = Indent.getNormalIndent(); + } + } if (isAfterStatementList(child) && !hasLineBreaksBefore(child, 2) && child.getElementType() != PyTokenTypes.END_OF_LINE_COMMENT) { // maybe enter was pressed and cut us from a previous (nested) statement list diff --git a/python/testData/formatter/wrapOnDot.py b/python/testData/formatter/wrapOnDot.py new file mode 100644 index 000000000000..917ec7497d29 --- /dev/null +++ b/python/testData/formatter/wrapOnDot.py @@ -0,0 +1,2 @@ +sitesettings = call(settings_manager +.get_whitelabel_settings_by_site_id(myuser.site_id)) \ No newline at end of file diff --git a/python/testData/formatter/wrapOnDot_after.py b/python/testData/formatter/wrapOnDot_after.py new file mode 100644 index 000000000000..c4f7e7edfeef --- /dev/null +++ b/python/testData/formatter/wrapOnDot_after.py @@ -0,0 +1,2 @@ +sitesettings = call(settings_manager + .get_whitelabel_settings_by_site_id(myuser.site_id)) \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyFormatterTest.java b/python/testSrc/com/jetbrains/python/PyFormatterTest.java index f6f671602d0f..2cfdf3ea8cbb 100644 --- a/python/testSrc/com/jetbrains/python/PyFormatterTest.java +++ b/python/testSrc/com/jetbrains/python/PyFormatterTest.java @@ -354,6 +354,10 @@ public class PyFormatterTest extends PyTestCase { doTest(); } + public void testWrapOnDot() { // PY-6359 + doTest(); + } + private void doTest() { doTest(false); }