小编bar*_*rdr的帖子

Visual Studio Code 格式上忽略 2 个空格的缩进选项卡大小(在 Python 中)

我想在 Python 的 Visual Studio Code(版本 1.38.1)中使用 2 个空格进行缩进(其他语言也是如此,但现在是 Python)。但是,当自动格式化时(保存并使用 Shift Alt F),它会将其更改为 4 个空格。

我已将其设置为使用 2 个空格,我可以在我的设置和右下角看到这 一点

这是我的设置:

{
    "editor.detectIndentation": false,
    "editor.insertSpaces": false,
    "editor.tabSize": 2,
    "editor.formatOnPaste": true,
    "window.zoomLevel": 0,
    "workbench.colorTheme": "Visual Studio Light",
    "editor.codeLens": false,
    "editor.formatOnType": true,
    "editor.formatOnSave": true
}
Run Code Online (Sandbox Code Playgroud)

我还更新了 config.py 文件

prefs['indent_size'] = 2
Run Code Online (Sandbox Code Playgroud)

我有 3 个扩展,Python、C# 和 yo。

我在互联网上搜寻无果,任何帮助将不胜感激!

python formatting indentation visual-studio-code

5
推荐指数
1
解决办法
5159
查看次数