VS Code python formatter (Black Formatter)

VS Code Extension搜尋Black Formatter, install

File->Preference->Settings, 搜尋ms-python.black-formatter

Default formatter換成Black Formatter

在Text Editor下的Formatting, 選擇Format On Save

或者

View->Command Palette (Shift+Ctrl+P), 搜尋Preference: Open User Settings (JSON)

加入以下代碼:

{
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.formatOnSave": true
}