2

To make Black and Isort below work, I need to save manually by pressing Ctrl+S on VSCode:

// "settings.json"

{
    ...
    "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter", // For Black
        "editor.formatOnSave": true // For Black
        "editor.codeActionsOnSave": {
            "source.organizeImports": true // For Isort
        }
    }
}

Now, I enabled Auto Save as shown below, then Auto Save itself works but Auto Save doesn't work with Black and Isort so I still need to save manually by pressing Ctrl+S to make Black and Isort work:

// "settings.json"

{
    ...
    "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter", // For Black
        "editor.formatOnSave": true // For Black
        "editor.codeActionsOnSave": {
            "source.organizeImports": true // For Isort
        }
    },
    "files.autoSave": "afterDelay", // For Auto Save
}

enter image description here

So, how can I make Black and Isort work with Auto Save on VSCode?

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129

0 Answers0