Continuation indent does not work

Completed

I have my indent set to 2 and my continuation indent set to 4 and the continuation indent has no effect.

For example, if I am writing this line (cursor marked with "|" character:

variable =|

and I hit enter, I get:

variable = \

  |

What I expect, obviously is for there to be 4 spaces before the cursor, not two. Why isn't the continuation indent being respected? This is a simple case, but it literally never works ever. Please help!

6 comments

I have the same problem. I have indent set to 4 and continuation indent set to 8. Yet when I run "Reformat Code", continuation lines are only indented 4.

2

I am experiencing the same issue (Indent: 2, Continuation indent: 4). It works with function definition parameters, for example:

def long_function_name(
    var_one, var_two, var_three,  # <--- indented 4
    var_four):  # <--- indented 4
  print(var_one)  # <--- indented 2

... but it doesn't work with function calls, for example:

long_function_name(
  var_one, var_two, var_three,  # <--- indented 2
  var_four)  # <--- indented 2

0

So, JetBrains, maybe you should fix this.

0

I just ran into this issue and found a solution.

Open up settings -> Editor -> Code Style -> Python. Under the "Other" tab there is a setting "Use continuation indent for arguments". I ticked that and it solved the problem.

I'm using the pro edition so I'm not sure if the community edition has this setting as well.

1

Yep, they released the fix in version 2017.1 (https://youtrack.jetbrains.com/issue/PY-21478).

I'm using the community edition and it's working for me too.

1

After much confusion and guessing at the issue, I discovered that disabling EditorConfig support in Settings -> Editor -> Code Style made it so my continuation indent settings took effect during code formatting.

0

Please sign in to leave a comment.