◀️ Previous step: Configure a packaging and dependency manager
A code formatter is a tool that automates code formatting according to predefined style rules. It ensures consistent code presentation, making it easier to read, maintain, and collaborate within a development team.
To get started you need to set up a formatter.
You can read this article to make your choice!
Name: Autopep8
Website Link: https://github.com/hhatto/autopep8
Name: Black
Website Link: https://black.readthedocs.io/en/stable/
Name: Yapf
Website Link: https://github.com/google/yapf
When your choice is made, you must modify the configuration file 'devcontainer.json' located in the directory named '.devcontainer/'.
You must modify the value of the attribute named 'editor.defaultFormatter'.
customizations
└── vscode
└── settings
└── settings
└── editor.defaultFormatter <<<
The possible values are :
- ms-python.autopep8 for 'Autopep8'
- ms-python.black-formatter for 'Black'
- eeyore.yapf for 'Yapf'
To use autopep8, the result should be :
"editor.defaultFormatter": "ms-python.autopep8",
To use Black, the result should be :
"editor.defaultFormatter": "ms-python.black-formatter",
To use Yapf, the result should be :
"editor.defaultFormatter": "eeyore.yapf",
The Visual Studio Code extension related to the formatter will be installed later.