Using ruff for everything in VSCode
howto astral python ruff vscode
2024-10-03
Ruff's VSCode extension is nice, and can handle the jobs previously done by black
and isort
. To turn on everything, and to run this on every file save (this is probably what you want, given it only takes a few milliseconds), use this configuration in .vscode/settings.json
:
{
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll": "explicit",
},
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true
},
}