From 74c850caf7e63375b41b600cadcdcf0b72d7d239 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Thu, 23 Jan 2014 17:57:38 +0100 Subject: [PATCH] Method call in indenting statement should have continuation indent. --- python/src/com/jetbrains/python/formatter/PyBlock.java | 5 +++++ .../formatter/continuationIndentInIndentingStatement.py | 6 +++++- .../continuationIndentInIndentingStatement_after.py | 6 +++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/python/src/com/jetbrains/python/formatter/PyBlock.java b/python/src/com/jetbrains/python/formatter/PyBlock.java index b9d47b37d3cf..8d76da821c9b 100644 --- a/python/src/com/jetbrains/python/formatter/PyBlock.java +++ b/python/src/com/jetbrains/python/formatter/PyBlock.java @@ -253,6 +253,11 @@ public class PyBlock implements ASTBlock { else if (parentType == PyElementTypes.REFERENCE_EXPRESSION) { if (child != _node.getFirstChildNode()) { childIndent = Indent.getNormalIndent(); + if (hasLineBreaksBefore(child, 1)) { + if (isIndentNext(child)) { + childIndent = Indent.getContinuationIndent(); + } + } } } diff --git a/python/testData/formatter/continuationIndentInIndentingStatement.py b/python/testData/formatter/continuationIndentInIndentingStatement.py index ee0874e2bbce..38c791070845 100644 --- a/python/testData/formatter/continuationIndentInIndentingStatement.py +++ b/python/testData/formatter/continuationIndentInIndentingStatement.py @@ -32,4 +32,8 @@ except \ while value \ in values: # <- missing continuation indent here - do_smth() \ No newline at end of file + do_smth() + +if (1 + x. + value()): + pass \ No newline at end of file diff --git a/python/testData/formatter/continuationIndentInIndentingStatement_after.py b/python/testData/formatter/continuationIndentInIndentingStatement_after.py index 26beec2a6b28..be1733778dbd 100644 --- a/python/testData/formatter/continuationIndentInIndentingStatement_after.py +++ b/python/testData/formatter/continuationIndentInIndentingStatement_after.py @@ -32,4 +32,8 @@ except \ while value \ in values: # <- missing continuation indent here - do_smth() \ No newline at end of file + do_smth() + +if (1 + x. + value()): + pass \ No newline at end of file