简体   繁体   English

如何在 Visual Studio Code 中显示更多选项卡空间? (实际上没有增加缩进大小)

[英]How to display more tab space in Visual Studio Code? (without actually increasing the indent size)

In js, 2 spaces are the golden standard for indent size.在 js 中,2 个空格是缩进大小的黄金标准。 With that said, if one were to try and share some code that had 3 or 4 spaces, that would probably annoy the heck out of whoever else is needing to use it.话虽如此,如果要尝试共享一些具有 3 或 4 个空格的代码,那可能会惹恼其他需要使用它的人。

The problem is that I have a pretty tough time visually seeing two-space indents, specifically when the start and end of an "indent block" are a screen tall or more (also, I have dyslexia, and this is probably amplifying this difficulty.) Regardless, I just spend nearly an hour trying to fix a "bug" that ended up just being me placing a variable in the wrong scope because I couldn't see the indent.问题是我很难在视觉上看到两个空格的缩进,特别是当“缩进块”的开始和结束是一个屏幕高或更高时(另外,我有阅读障碍,这可能会放大这个困难。 ) 不管怎样,我只花了将近一个小时试图修复一个“错误”,结果只是我将一个变量放在错误的 scope 中,因为我看不到缩进。 I can't stand two spaces, it's too small.我受不了两个空格,太小了。 Having a larger indent would prevent problems like this from occurring in the future.有一个更大的缩进可以防止这样的问题在未来发生。

So, is there any way to display more than two indent spaces without having to actually change the indent size?那么,有什么方法可以显示两个以上的缩进空间而不必实际更改缩进大小? (so that when I push or do a pull request on github, the resulting document only has 2 space indents.) (这样当我在 github 上推送或执行拉取请求时,生成的文档只有 2 个空格缩进。)

There is an extension, called indent-switcher , which does exactly what you need.有一个名为indent-switcher的扩展,它完全符合您的需要。 You can manually change the indent from 2 to 4 or from 4 to 2.您可以手动将缩进从 2 更改为 4 或从 4 更改为 2。

I'm not sure if this indent will affect your code when you pull or push it to github.我不确定当您将代码拉取或推送到 github 时,此缩进是否会影响您的代码。 But you could just change it from 2 to 4 while working on it and change it from 4 to 2 when you are finished.但是您可以在处理时将其从 2 更改为 4,并在完成后将其从 4 更改为 2。 You can also bind the commands to a keyboard shortcut.您还可以将命令绑定到键盘快捷键。 There is also another extension called indent-rainbow.还有另一个扩展名为 indent-rainbow。 This could also come in handy for you.这也可以为您派上用场。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM