VS Code 忽略全局 `tabSize` 设置

VS Code ignores global `tabSize` setting

相关用户设置:

"editor.tabSize": 2,
"editor.detectIndentation": false,

工作space 设置为空。使用 VS 代码 1.52.0.

.cpp 文件格式正确(使用 Format Document 选项),但在 .py 文件中,它将所有缩进更改为 4 spaces 并插入一些不必要的垂直间距(例如,双空一些地方有线条)。唯一特定于 Python 的设置是 pythonPathcondaPath.

编辑:插入这个:

"python.formatting.autopep8Args": [
  "--ignore",
  "E301, E302, E305, E306, E101, E11"
],

into settings.json 阻止它将 2 space 缩进更改为 4 space 缩进,但现在它完全忽略了缩进。我希望它将缩进更正为 2 spaces。使用this作为参考。

编辑:我想要这个: 固定为: 但它会像这样修复:

请在“settings.json”中使用以下设置:

"python.formatting.autopep8Args": ["--indent-size=2"],

我使用的相关设置:

"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.renderWhitespace": "all",
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": ["--indent-size=2"],