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!

4
13 comments
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

So, JetBrains, maybe you should fix this.

1
Avatar
Permanently deleted user

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.

3

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
Avatar
Permanently deleted user

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.

5

Yes, EditorConfig is the issue... And you guessed it, still not fixed in 2019.

6

Still not fixed in 2020.

0

Hi Mythobeast, could you please create a ticket in the bug tracker https://youtrack.jetbrains.com/issues/PY explaining the exact issue you are facing?

0

Still not fixed in 2021.

0

Hi Majid, please consider creating a ticket in our bug tracker and describing your case.

0

I can't believe this is still broken in 2023.  It's destroying my files and is unusable.

0
Hello, 
Please create a bug report here: https://youtrack.jetbrains.com/issues/PY and attach your idea.log and screenshot of your indent settings.
0

Please sign in to leave a comment.