Skip to content

The if statement is automatically formatted incorrectly after carriage return #1096

@pcloth

Description

@pcloth

Environment data

  • VS Code version: 1.21.1
  • Extension version: 2018.2.1
  • OS and version: windows 10 x64
  • Python version (Anaconda): 3.5.1
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A

Case

The cursor is at (enter) position, and I press Enter:

if 1<=2: (enter)

Actual behavior

It removes spaces before expressions and inserts spaces between less than and equal signs. Causes syntax errors

if1 < = 2:
    |

If you replace 1 with a variable, there is only the error of inserting spaces before the equal sign.

if num < = 2:
    |

Expected behavior

if 1 <= 2:
    |

Metadata

Metadata

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions