Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99733

VSCode not autoformatting on save

$
0
0

Vscode is not formatting my code on save.

My vscode versions are thus:

  • Vscode 1.37.0 (updated it as part of bug shooting, not sure previous version, but this didn't work either)
  • autopep8 1.4.4 (pycodestyle: 2.5.0)

My settings.json look like this:

{
    "editor.detectIndentation": false,
    "editor.formatOnSave": true,
    "editor.insertSpaces": true,
    "editor.tabSize": 4,
    "python.formatting.autopep8Args": [
        "--max-line-length=120"
    ],
    "python.formatting.provider": "autopep8",
    "python.linting.enabled": true,
    "python.linting.lintOnSave": true,
    "python.linting.pep8Args": [
        "--max-line-length=120"
    ],
    "python.linting.pep8Enabled": true,
    "python.linting.pylintEnabled": false,
    "python.pythonPath": "/home/me/.python_virtualenvs/somepath"
}

Why is autoformatting on save not working?

Additional notes:

  • This correctly formatted my file: python -m autopep8 --max-line-length 120 --in-place --aggressive --aggressive my_dirty_code.py
  • I can see Formatting with autopep8 in the taskbar on save

Viewing all articles
Browse latest Browse all 99733

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>