Visual Studio Code:格式未使用缩进设置 [英] Visual Studio Code: format is not using indent settings

查看:30
本文介绍了Visual Studio Code:格式未使用缩进设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual Studio Code 中使用 Format Code 命令时,它不遵守我的缩进设置 ("editor.tabSize": 2).它使用 4 的选项卡大小.任何想法为什么会发生这种情况?

When using the Format Code command in Visual Studio Code, it is not honoring my indent settings ("editor.tabSize": 2). It is using a tab size of 4 instead. Any ideas why this is happening?

谢谢!

推荐答案

用于格式化的空格数取自不同的位置.我使用的是 1.0 版,这是我为修复它所做的(我假设您使用空格而不是制表符):

The number of spaces to use for formatting is taken from a different location. I'm using version 1.0 and this is what I've done to fix it (I'm assuming your using spaces instead of tabs):

在右侧编辑器的底部点击空格:#":

At the bottom of the editor on the right hand click "Spaces: #":

然后一个菜单会出现在顶部.选择使用空格缩进":

Then a menu will appear up top. Select "Indent Using Spaces":

最后,您可以选择您希望文件缩进多少个空格.

Finally you can select by how many spaces you want your files to be indented.

下次格式化文件时,您应该能够获得配置的间距.

The next time you format a file you should be able to get the spacing you configured.

这篇关于Visual Studio Code:格式未使用缩进设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆