Skip to content

Improve auto-indentation behaviour #481

Closed
@balta2ar

Description

@balta2ar

Environment data

VS Code version: Version 1.19.0
Commit 816be6780ca8bd0ab80314e11478c48c70d09383
Date 2017-12-14T09:56:48.842Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

Python Extension version: 0.9.1
Python Version: Python 3.6.3
OS and version: ArchLinux

Case 1

The cursor is at | position (about to add second argument to print), and I press Enter:

Actual

def case1():
    print('first_argument', |)

It becomes:

def case1():
    print('first_argument', 
    |)

Expected 1

def case1():
    print('first_argument'
        |)

OR Expected 2 (this one is preferred)

def case1():
    print('first_argument'
          |)

Case 2

Actual

The cursor is right after the closing parenthesis and I press Enter.

def case2():
    print(
        'some_very_very_very_very_long_function_argument_',
        'second_argument')|

It becomes:

def case2():
    print(
        'some_very_very_very_very_long_function_argument_',
        'second_argument')
        |

Expected

def case2():
    print(
        'some_very_very_very_very_long_function_argument_',
        'second_argument')
    |

Case 3

Actual

The cursor after the comment. Press Enter:

def case3(): # some comment|

It becomes:

def case3(): # some comment
|

Expected

def case3(): # some comment
    |

Same with comments after for loops:

def case3(): # some comment
    for i in range(1): # another comment|

after pressing Enter becomes

def case3(): # some comment
    for i in range(1): # another comment
    |

Expected:

def case3(): # some comment
    for i in range(1): # another comment
        |

Also look at #3284

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-editor-*User-facing catch-allarea-formattingfeature-requestRequest for new features or functionalitymetaIssue that is tracking an overall projectneeds PRReady to be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions