microsoft/vscode-autopep8

Format not working on file save

jokance opened this issue · 2 comments

After I save the .py file I got these log:

2023-11-03 11:00:39.851 [info] [Trace - 11:00:39 AM] Sending request 'textDocument/formatting - (2)'.
2023-11-03 11:00:39.856 [info] [Trace - 11:00:39 AM] Received notification 'window/logMessage'.
2023-11-03 11:00:39.857 [info] c:\Users\myname\.virtualenvs\XXX\Scripts\python.exe -m autopep8 --max-line-length 180 -
2023-11-03 11:00:39.857 [info] [Trace - 11:00:39 AM] Received notification 'window/logMessage'.
2023-11-03 11:00:39.857 [info] CWD Server: f:\Projects\XXX\Client\UEGame\Content\Scripts\Common
2023-11-03 11:00:40.031 [info] [Trace - 11:00:40 AM] Received notification 'window/logMessage'.
2023-11-03 11:00:40.031 [info] cannot mix stdin and regular files
2023-11-03 11:00:40.031 [info] [Trace - 11:00:40 AM] Received response 'textDocument/formatting - (2)' in 180ms.

I have following configuration in .code-workspace file:

"autopep8.args": [
    "--max-line-length 180"
],
"[python]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "ms-python.autopep8",
},

Windows: 10 21H2
VSCode: 1.84.0
autopep8: v2023.6.0

@jokance You arguments are passed wrong, pass it like this:

"autopep8.args": [
    "--max-line-length", "180"
]

You can eve do this:

"autopep8.args": [
    "--max-line-length=180"
]

@karthiknadig It works. tks!