microsoft / vscode-autopep8

Formatting support for python using autopep8.
https://marketplace.visualstudio.com/items?itemName=ms-python.autopep8
MIT License
19 stars 12 forks source link

Autopep8 argument didn't works #256

Closed bagustris closed 5 months ago

bagustris commented 5 months ago

I tested it works with autopep8 command line but failed with this extension.

Steps to reproduce,

autopep8 --in-place --aggressive --aggressive file.py

Setting in settings.json

{
[python]":
 "editor.defaultFormatter": "ms-python.autopep8",
  "editor.formatOnSave": true,
    "autopep8.args": [
        "--in-place",
        "--aggressive",
        "--aggressive"
    ],
}

So I assume that the problem is with this vscode extension and not the original autopep8 and report the problem here.

When I hover in the argument parts, it says: This setting cannot be applied because it is not registered as language override setting.

karthiknadig commented 5 months ago

image

The extension does not support using—in-place. This is by design. This is to support formatting unsaved files and notebook cells. if you want to format on save, the content is not on disk yet. The content is in memory. We use autopep8 formatting over stdin to achieve this.

bagustris commented 5 months ago

@karthiknadig OK, I confirmed it works if I deleted --in-place but only if these args are located outside [python]. It won't work if these args are located inside [python].