Correct python indentation in Visual Studio Code

Python Indent

Correct python indentation in Visual Studio Code. See the extension on the VSCode Marketplace and its source code on GitHub.

Python-Indent

How it works

Every time you press the Enter key in a python context, this extension will parse your python file up to the location of your cursor, and determine exactly how much the next line (or two in the case of hanging indents) should be indented and how much nearby lines should be un-indented.

There are three main cases when determining the correct indentation, described below.

Between bracket pairs

In cases when you have your cursor between an open bracket (one of [({) and its closing bracket pair (the corresponding one of })]), this extension will keep subsequent lines indented just

 

 

 

To finish reading, please visit source site