Skip to content

Indentation level of else:-type lines is not reduced #771

Closed
@nathdwek

Description

@nathdwek

Environment data

VS Code version:

1.20.0
c63189deaa8e620f650cc28792b8f5f3363f2c5b
x64

Python Extension version: 2018.1.0
Python Version: 3.6.3
OS and version: Ubuntu 2017.10 AMD64

Actual behavior

After typing enter at the end of a line such as else:, elif cond:, except:, finally:, the indentation level of that line is unchanged and the next line is auto-indented to the wrong level as well:

if cond:
    do_stuff()
    else:|

after typing enter, becomes

if cond:
    do_stuff()
    else:
        |

Expected behavior

if cond:
    do_stuff()
    else:|

after typing enter (or : on atom if I remember correctly), should become

if cond:
    do_stuff()
else:
    |

Steps to reproduce:

  • Use a construct as if-elif-else, try-except-else-finally.

Is this normal? I expect that this is a problem with my setup and not this extension given the simplicity of the issue, but my install is as standard as can be...

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-formattingbugIssue identified by VS Code Team member as probable bugwindows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions