“editor.insertSpaces"和“editor.insertSpaces"有什么区别?和“editor.tabSize"在设置? [英] What's the difference between "editor.insertSpaces" and "editor.tabSize" in settings?

查看:35
本文介绍了“editor.insertSpaces"和“editor.insertSpaces"有什么区别?和“editor.tabSize"在设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它们有什么不同的解释?我只能看到editor.tabSize"的作用,也就是一个tab占用的空格数.

How are they interpreted differently? I can only see what "editor.tabSize" does, which is the number of spaces that a tab occupies.

谢谢.

推荐答案

来自配置文件:

{
  // Controls the rendering size of tabs in characters. 
  // If set to auto, the value will be guessed based on the opened file.
  "editor.tabSize": 4,

  // Controls if the editor will insert spaces for tabs. 
  // If set to auto, the value will be guessed based on the opened file.
  "editor.insertSpaces": true
}

如您所见,editor.tabSize 设置了输入 tab 时占用的空间大小.editor.insertSpaces 在文件中配置存储的密​​钥代码.

As you can see editor.tabSize sets the size of space occupied when you enter tab. While editor.insertSpaces configures the stored key code in file.

如果 editor.insertSpaces 等于 false,那么 Visual Studio Code 将为每个 tab 插入一个 #09 字符.当您更改 editor.tabSize 时,您现有的代码更改所有行中的缩进,并存储一个 #09 字符.

If editor.insertSpaces equals false then Visual Studio Code will insert one #09 character for each tab. When you change editor.tabSize your existing code will change indentation in all lines a #09 character is stored.

如果 editor.insertSpaces 等于 true 然后 Visual Studio Code 将为每个 tab 插入 space 字符而不是#09 个字符.插入的空格的数量在editor.tabSize中配置.当您更改 editor.tabSize 时,您现有的代码不会更改缩进,因为文件中没有存储 #09 字符.editor.tabSize 的新值只会影响新的 tab 笔画.

If editor.insertSpaces equals true then Visual Studio Code will insert space characters for each tab instead of #09 characters. The amount of inserted spaces is configured in editor.tabSize. When you change editor.tabSize your existing code will not change indentation since there is no #09 character being stored in the file. Only new tab strokes will be affected by the new value of editor.tabSize.

如果您和其他团队成员使用only tab 进行缩进,那么将 editor.insertSpaces 设置为 false 没有问题.如果您和其他团队成员使用 space tab 进行缩进,那么您应该将 editor.insertSpaces 设置为 true.否则,当有人使用不同的 editor.insertSpaces 值打开文件时,您的文件可能看起来很尴尬.

If you and other team members use only tab for indentation then it is no problem to set editor.insertSpaces to false. If you and other team members use space or tab for indentation then you should set editor.insertSpaces to true. Otherwise your files can look awkward when somebody opens a file with a different value of editor.insertSpaces.

这篇关于“editor.insertSpaces"和“editor.insertSpaces"有什么区别?和“editor.tabSize"在设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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