When I type the python code in vs code, indent tab size is 2. But when I save the file, tab size is changed to 4. I think this is because of autopep8.
How can I change the tab size, when I save the python code?
※ I already change editor.tabsize to 2
When I type the python code in vs code, indent tab size is 2. But when I save the file, tab size is changed to 4. I think this is because of autopep8.
How can I change the tab size, when I save the python code?
※ I already change editor.tabsize to 2
It's recommended to set '--indent-size' to change the autopep8 behavior. You can refer to this page for details. But I can't make it works in this way, so I directly make a change in autopep8.py(under site-packages which you installed the autopep8) file, at the line of 112 change "DEFAULT_INDENT_SIZE = 4" to "DEFAULT_INDENT_SIZE = 2". It works and it's the same to set '--indent-size' in logic.
You will need to configure autopep8 to keep indent to two spaces. That way it won't undo how VS Code is inserting spaces for you.