如何在Visual Studio Code for Mac上配置插入空格而不是选项卡

时间:2015-06-27 07:53:06

标签: editor

我开始使用Visual Studio Code。当前版本是0.3.0 默认情况下,会为选项卡插入缩进 但我想插入4个空格而不是标签。

我找不到配置首选项中的项目。

请告诉我,如何配置插入标签或空格。

2 个答案:

答案 0 :(得分:2)

大约从版本0.9.0开始,通过修改 settings.json 文件中的以下参数,可以轻松访问此配置:

// Controls the rendering size of tabs in characters. Accepted values: "auto", 2, 4, 6, etc. If set to "auto", the value will be guessed when a file is opened.
"editor.tabSize": 4,

// Controls if the editor will insert spaces for tabs. Accepted values:  "auto", true, false. If set to "auto", the value will be guessed when a file is opened.
"editor.insertSpaces": true

有关其他设置和信息,请访问VS代码help部分。

答案 1 :(得分:0)

您正在寻找的是keybindings.json。从菜单代码 - > 偏好设置 - > 键盘快捷键

在右侧窗格中,您可以放置​​键绑定,例如:

{"key": "ctrl+t",      "when": "editorTextFocus", "command": "editor.action.tab"}

虽然你可能更喜欢这样的东西:

{"key": "ctrl+t",      "when": "editorTextFocus", "command": "    "}

问题在于它不起作用,因为文档说它应该! 请参阅:Customization of Visual Studio Code

Microsoft已收到行为通知,并且还请求了标签处理首选项。

相关问题