Le problème était dans les mauvais paramètres. Pour utiliser yapf, black ou autopep8, vous avez besoin :
- Installez yapf / noir / autopep8 (pip install noir)
- Configurer
.vscode/settings.json
de la manière suivante :
partie du fichier :
{
"python.linting.enabled": true,
"python.linting.pylintPath": "pylint",
"editor.formatOnSave": true,
"python.formatting.provider": "yapf", // or "black" here
"python.linting.pylintEnabled": true,
}
Option clé - "editor.formatOnSave": true,
cela signifie yapf
formate votre document à chaque fois que vous l'enregistrez.