bar*_*rdr 5 python formatting indentation visual-studio-code
我想在 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 扩展支持的格式化程序都没有读取 VS Code 的格式化设置。您需要直接配置格式化程序以使其保持 2 个空格缩进(这会因格式化程序而异,如果您选择黑色,甚至无法配置)。
归档时间: |
|
查看次数: |
5159 次 |
最近记录: |