如何在Visual Studio Code中设置特定于Python语言的制表符间距? [英] How to set Python language specific tab spacing in Visual Studio Code?
问题描述
使用带有(donjayamanne)Python 0.5.8扩展名的VSCode 1.9.0,是否可以提供特定于Python的编辑器选项?
Using VSCode 1.9.0 with the (donjayamanne) Python 0.5.8 extension, is it possible to provide Python specific editor options?
或更笼统地说,是否可以提供特定于语言的制表符间距和替换规则?例如,Python应该制表符= 4个空格(替换为空格),而Ruby应该制表符= 2个空格(替换)。其他语言倾向于有自己的见解。但是,我只看到常规的
Or more generally speaking, is it possible to provide language specific tab spacing and replacement rules? For example, Python should be tab=4 spaces (replaced as spaces), and Ruby should be tab=2 spaces (replaced). Other languages tend to have their own opinions. However, I only see the general
"editor.tabSize": 4,
"editor.insertSpaces": true,
选项。
我想也许有一个 python.editor:{}
块,或者一个 python.editor.tabSize
选项,但我找不到对此的引用,也无法成功猜出一个有效的名称。
I thought perhaps there was a "python.editor": { }
block or perhaps a "python.editor.tabSize"
option, but I can't find reference to such, nor have I successfully guessed a working name.
推荐答案
我今天遇到了同样的问题。
这就是我解决的方法。在VSCode中的setting.json中添加以下行:
I had the same problem today.
This is how I fixed it. Add this lines in setting.json in VSCode:
"[python]": {
"editor.insertSpaces": true,
"editor.tabSize": 4
}
它有效像护身符。
这篇关于如何在Visual Studio Code中设置特定于Python语言的制表符间距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!